Home > Back-end >  Bosses and see me again
Bosses and see me again

Time:12-11

Program, set up a 3 singly linked list of nodes, each node contains name, age and salary, write two functions, one is used to establish list, another is used to output list,
#include
#include
# define stu struct student
Stu
{
Char name [20].
Int the age;
Int wage;
Stu * next;
};
Stu * creat (void)
{
Stu * head;
P1 struct Student * * (p2);
Int n=0;
P1=p2=(struct Student *) malloc (sizeof (struct Student));
The scanf (" % f, % ld ", & amp; P1 - & gt; Num, & amp; P1 - & gt; Score);
The head=NULL;
While (p1 - & gt; Num!=0)
{
n++;
If (n==1) head=p1;
The else p2 - & gt; Next=p;
P1 p2=;
P1=(struct Student *) malloc (sizeof (struct Student));
The scanf (" % f, % ld ", & amp; P1 - & gt; Num, & amp; P1 - & gt; Score);
}
The p2 - & gt; Next=NULL;
Return (the head);
}
Void the output (stu * p)
{
While (p!=NULL)
{
Printf (" % s ", p - & gt; Name);
Printf (" age=% d wage=% d \ n ", p - & gt; Age, p - & gt; Wage);
P=p - & gt; Next;
}
}

Void main ()
{
Stu * p;
P=creat ();
The output (p);
}
Help have a look at where is wrong, bosses

CodePudding user response:

Bosses have a look at me

CodePudding user response:

You must first say your problem is

CodePudding user response:

The left part of the specified undefined structure/joint "Student", thank you for your bosses

CodePudding user response:

The student pay attention to the case, in some places the capital

CodePudding user response:

Changed, but can't run

CodePudding user response:

Don't run, or error, set breakpoints, debugged, and see where the problem
  • Related