how do you retain them if you wanted to form a linked list ?. if it is a one node you can use it, but if you want multiple nodes, how you can form a linked list ?. Context will be lost once returned from the function, if you static you will have only one copy, how you can make linked list out of it. Then you need a array of nodes... :( etc etc.
Thanks, Sathaiah Dontula On Wed, Mar 24, 2010 at 9:16 AM, chitta koushik <[email protected]>wrote: > malloc returns a void pointer to the allocated chunk of memory. > > > On Wed, Mar 24, 2010 at 2:42 AM, aman goyal <[email protected]> wrote: > >> why do we use malloc funtcn to allocate memory for a stuct node variable >> pointer.. >> why dont we simply write struct node p; >> instead we do >> struct node *p >> p=malloc(........); >> >> any valid reasons for this?? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<algogeeks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
