Home > Back-end >  This code is right, behind the linked list node values show not to come out? Pray god to help
This code is right, behind the linked list node values show not to come out? Pray god to help

Time:10-05

#include
#include
#include
8 # define N
Struct list
{
int data;
Struct list * next;
};
Struct list * getlink (int [] b, int b1);
Void myput (struct list * p);
Int main (void)
{struct list * head;
Int a [N].
int i;
Printf (" please enter eight number: ");
for(i=0; i{
The scanf (" % d ", & amp; A [I]);
}
The head=getlink (a, N);
Myput (head);
return 0;
}
Struct list * getlink (int [b], int b1)
{
Struct list * s * h;
int i;
H=NULL;
For (I=b1-1; i>=0; I -)
{
S=(struct list *) malloc (sizeof (struct list));
S - & gt; data=https://bbs.csdn.net/topics/b [I];
S - & gt; Next=NULL;
If (h=NULL)
H=s;
The else
{
S - & gt; Next=h;
H=s;
}
}
Return h;
}
Void myput (struct list * p)
{

Printf (" \ n output the final list of all nodes: ");
While (p)
{
Printf (" % d ", p - & gt; The data);
P=p - & gt; next;
}
printf("\n");
}

  • Related