A common idiom for dynamic allocation is
T *p = malloc(sizeof *p * num_elements);
or
T *p; ... p = malloc(sizeof *p * num_elements);
So the correct way to highlight f :
f = malloc(sizeof *f)
Dumping in C is not needed, and discarding the malloc result is not recommended. Since the type of the expression *f is FILE * , sizeof *f same as sizeof (FILE *) , except that with sizeof *f you don't have to worry about making sure you have the right type.
source share