I try to initialize a structure pointer with another structure pointer inside by C programming, otherwise i get the segmentation fault. The structure is defined as below:
`struct gfcontext_t{
char *fileContent;
size_t fileLength;
char *response;
int socket_hd;
};
struct gfserver_t{
char *serverName;
int serverPort;
int maxConnection;
ssize_t (*handler)(struct gfcontext_t *, char *, void * );
struct gfcontext_t *ctx;
int status;
};
The initialization is give inside a function:
gfserver_t * gfserver_create(){
struct gfserver_t *gfs;
gfs=(gfserver_t*) malloc(sizeof(struct gfserver_t));
......//how to do the initialization?
return gfs;
}`