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.comwrote:
malloc returns a
struct are passed by value..not by reference...
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();
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
Hi Achala,
This fails for:
0 1 2000 3 4 5 6
prog's output:
arr[j]=2000,arr[k]=0,j=2,k=0
correct output should be:
arr[j]=6,arr[k]=0,j=6,k=0
you seem to be relying on the difference in the 'values' (contents) instead
of the index span.
On Mon, Mar 22, 2010 at 11:10 PM, achala sharma
This is because by definition linked lists are dynamic.. If they reside on
stack they cannot be dynamic (extensible in size)
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
thanx to all.special one to Sathaiah Dontula ..i got ur point and it is
completely valid..!!!
On Wed, Mar 24, 2010 at 1:37 PM, TurksHead Education
turksheadeducat...@gmail.com wrote:
This is because by definition linked lists are dynamic.. If they reside on
stack they cannot be dynamic
Please post your results. I'd like to study your algorithm.
On Mar 23, 11:15 pm, chitta koushik koushik.infin...@gmail.com
wrote:
yeah i understand that . still wanted to attempt writing a recursive
reverse() stack operation.
On Wed, Mar 24, 2010 at 9:21 AM, Rohit Saraf