As NULL in C is #defined as
#define NULL ( (void *) 0)
And
as c supports implicit type conversion so in case of struct node* head= NULL, from the (#define ) mentioned above NULL will automatically be type-casted into (struct node*) NULL.
Which in the next case you are doing manually.