Why did this code still work?
Posted
by bstullkid
on Stack Overflow
See other posts from Stack Overflow
or by bstullkid
Published on 2010-05-05T20:20:09Z
Indexed on
2010/05/05
20:28 UTC
Read the original article
Hit count: 156
Filed under:
c
Some old code that I just came across:
MLIST * new_mlist_link()
{
MLIST *new_link = (MLIST * ) malloc(sizeof(MLIST));
new_link->next = NULL;
new_link->mapi = NULL;
new_link->result = 0;
}
This was being called to build a linked list, however I noticed there is no statement:
return new_link;
Even without the return statement there, the list still got built properly. Why did this happen?
EDT: Platform: Mandriva 2009 64bit Linux 2.6.24.7-server GCC 4.2.3-6mnb1
© Stack Overflow or respective owner