Generally, one must cast the result of
malloc
to the type you want to use. Something like this :
struct node *link = (struct node *) malloc((sizeof *link) + 25 * (sizeof *link->filename));
If you have declared node like this :
struct node
{
};
then the preceding
struct
word is not needed in the cast and you can declare variables like this :
node * link = NULL;
Incidentally, I always use
calloc
instead of
malloc
because it initializes the allocated memory to zeros automatically.