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.
solved Segmentation fault while copying string to a char array using memcpy