malloc() is a method used for dynamic memory allocation. malloc() creates a block of memory whenevr that function is called and in our case we are pointing our structure pointer to that memory block.
“Every pointer needs to be pointed to a memory before it is accessed”.
In this case the memory of the size of the structure will get allocated only after the malloc() is called. Once you’ve done, you can remove that memory using the function free().
Suggest you to google it for a good tutorial
Still having doubts, please feel free to post here.