Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

malloc or not to malloc

$
0
0
hello. I'd like to know why didn't I need to write malloc for the function below. list_data(element) returns a void*. is it because we don't allocate memory for void pointers?

int* data;
/* some more code */
while(true)
{
         data = list_data(element);
         fprintf(stdout, "list[%03d] = %03d\n", i, *data);
        
         if(list_is_tail(element))
         break;
         else
         element = list_next(element);
         i++;
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles