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;
}

pointer is not initialized ..
Following code ay help ..

#define MAX 100

data first;
data *fp;

first.name = malloc(MAX);

fp = &first;

scanf("%s",first.name);
printf("fp is %s\n",fp->name);