Hi,I am trying to scan a string to char *name inside struct data but it gives me segmentation fault.
please help
thanks.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
struct data
{
char *name;
};
typedef struct data data;
int main(void)
{
data first;
data *fp;
fp=&first;
char *word;
word="ABC";
sscanf(word,"%s",(char *)fp->name);// I need to scan a string to char *name inside struct data
printf("fp is %s\n",fp->name);
return 0;
}