[Solved] C: allocate a pointer


head=malloc(sizeof(node*));

Will allocate a space in memory to hold a POINTER to a object of type node.

head=malloc(sizeof(node));

Will allocate space for the structure itself, and return to you the address of that memory space, and you will hold that in the head variable

For more info, check this other question about Malloc.
How do free and malloc work in C?

2

solved C: allocate a pointer