+ 1

What are the difference Between " Struct list *file ;" and "Struct list *file = malloc(sizeof(*file));" ?

29th Jun 2019, 12:07 PM
RATIARIVELO Nekena Rayane
RATIARIVELO Nekena Rayane - avatar
5 Antworten
+ 2
~ swim ~ Sorry, I read it as struct list *file = malloc(sizeof(file)); In my defence, it's pretty weird. struct list *file = malloc(sizeof(struct list)) is much more common.
30th Jun 2019, 2:36 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
The difference is that the second example is wrong.
29th Jun 2019, 12:54 PM
Vlad Serbu
Vlad Serbu - avatar