[Solved] Segmentation fault while copying string to a char array using memcpy
[ad_1] You have to allocate memory for structure and it’s member and then after you can do copy data in it. A *a = malloc(sizeof(A)); a->name=malloc(100); //change the size other then 100 what ever you want. [ad_2] solved Segmentation fault while copying string to a char array using memcpy