#include
#include
#include
# define _CRT_SECURE_NO_WANRINGS
Struct the info//books information
{
int num;
Char name [101].
Char author [101].
Char pub [101].
Char kind [101].
Float price;
};
Struct Node
{
Struct info data;//data domain
Struct Node * next;//pointer field
};
Struct Node * creatList ()//build header
{
Struct Node * headNode=(struct Node *) malloc (sizeof (struct Node));//by malloc function will headNode pointer to struct variable
HeadNode - & gt; next=NULL;//initialize a variable
Return headNode;//return pointer
}
Struct Node * creatNode (struct info data)//create Node
{
Struct Node * newNode=(struct Node *) malloc (sizeof (struct Node));
NewNode - & gt; data=https://bbs.csdn.net/topics/data;
NewNode - & gt; next=NULL;
Return the newNode;
}
Void insertNodeByhead (struct Node * headNode, struct info data)//head interpolation insert Node
{
Struct Node * newNode=creatNode (data);
NewNode - & gt; Next=headNode - & gt; Next;
HeadNode - & gt; Next=newNode;
}
Void printfNode (struct Node * headNode)//print Node
{
Struct Node * pMove;//since the second node print
PMove=headNode;
While (pMove!=NULL)//build cycle
{
Printf (" % d % s % s % s % s % f ", pMove - & gt; Data. The num, pMove - & gt; Data. The name, pMove - & gt; Data. The author, pMove - & gt; Data. The pub, pMove - & gt; Data. Price);
Printf (" % d ", pMove - & gt; Data. The num);
PMove=pMove - & gt; Next;
}
}
Struct Node * List=NULL;//define global list
Struct info book;
Int main ()
{
List=creatList ();//initializes the global chain table//define structure the staging data
Printf (" input information from books, ");
The scanf (" % d % s % s % s % s % f ", & amp; Book num, book. The name of the book. The author, book, pub, book. Kind, & amp; Book. Price);
InsertNodeByhead (List, book);
PrintfNode (List);
return 0;
}
CodePudding user response:
Debugging is not displayed acess violenceCodePudding user response:
PrintfNode function inside the printf, isn't it a less pMove - & gt; Data. The kind,