No, this is a snipped from the code. I have mentioned here the structure definition(which is obviously global) and the function in which it is used.
The function is used in the main function. The error occurs at line 10
Appears as if you are compiling it as C++ code instead of C.
PS. When you post code snippets, try including everything relevant to the given piece of code/errors. I.e. in this case, you most likely are including <stdlib.h>, but that does not show in the snippet (even little things can make a whole lot of difference in terms of the compiler output).
In case of C++ compiler, you need to typecast the pointer returned by malloc() , in C, you don't have to do that.