Declaring a pointer to a struct, does not allocate storage for the struct and does not initialize the pointer.
typedef struct s1 { double x; int n; char c1; char c2; } S1; S1 *p; p = (S1 *) malloc(sizeof(S1)); p->x = 3.5; p->n = 0; p->c1 = 'a'; p->c2 = 'b'; /* or you could write */ (*p).x = 3.5; (*p).n = 0; (*p).c1 = 'a'; (*p).c2 = 'b';