#include
Struct linkedlist
{
The int data;
Struct linkedlist * next;
};
Struct linkedlist * creatlinkedlist ()
{
int n;
Ph, struct linkedlist * * p * q;
Ph=(struct linkedlist *) malloc (sizeof (struct linkedlist));
P=q=ph;
Printf (" please enter into the number in the list: \ n ");
The scanf (" % d ", & amp; N);
while(n!=1)
{
Q=(struct linkedlist *) malloc (sizeof (struct linkedlist));
P - & gt; Next=q;
Q - & gt; data=https://bbs.csdn.net/topics/n;
P=q;
The scanf (" % d ", & amp; N);
}
Q - & gt; Next=NULL;
Return (ph);
}
Int main (int arg c, char * argv [])
{
Struct linkedlist * head;
The head=creatlinkedlist ();
Return 0;
}
Tips:
Build a unnamed 4: zero error, a warning
Generate C: \ Users \ \ Temp \ \ Documents \ C - 33542 Free unnamed 4. Exe
to run the program error.
Bosses, bother about running a simple no problem, not a little more complicated, can appear to run the program error, have download again for several times, still won't do,
CodePudding user response:
Warning there should be no # include & lt; Stdlib. H> Because malloc prototype is in the header fileWhat is simple operation, a little more complicated now?
In addition to the head of code - & gt; Date by using the node belongs to waste, no other input data are in series in the back, single necklace table have formed,
CodePudding user response:
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.htmlI hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html