struct node* p is only a declaration, i.e., it only tell the compiler the
type of p and no memory is allocated for it.
Before using p, we need to allocate memory to it... so we do p =
malloc(...).

On Wed, Mar 24, 2010 at 9:16 AM, chitta koushik
<koushik.infin...@gmail.com>wrote:

> malloc returns a void pointer to the allocated chunk of memory.
>
>
> On Wed, Mar 24, 2010 at 2:42 AM, aman goyal <aman...@gmail.com> 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 algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thanks and Regards
Shobhit Bhatnagar
DUMCA | 2006-09

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to