Home > Back-end >  Please god help me to analyze this string of code, look not to understand
Please god help me to analyze this string of code, look not to understand

Time:11-05

#include
#include
#include

//define node
Typedef struct LinkList
{
The int data;
Struct LinkList * next;
} the node;
//initialization list
Void Initialise (node * * pNode, int item)//* * pNode pNode pointer to a pointer pointing to the object or a pointer
{
Node * TMP;
Node * target;
Int I=1;
While (I & lt;=item)
{
If (* pNode==NULL)
{
* pNode=(*) malloc (sizeof (LinkList));
if(!
(* pNode).{
The exit (0);//out
}
(* pNode) - & gt; Data=https://bbs.csdn.net/topics/i;
(* pNode) - & gt; Next=* pNode;
i++;
}
The else
{
Target=* pNode;
While (target - & gt; Next!=* pNode)
{
Target=target - & gt; Next;
}
TMP=(*) malloc (sizeof (LinkList));
if(! TMP)
{
The exit (0);
}
TMP - & gt; Data=https://bbs.csdn.net/topics/i;
i++;
TMP - & gt; Next=* pNode;
Target - & gt; Next=TMP;
}
}
}
//traverse the list
Void Traversal (node * pNode)
{
Node * TMP;
TMP=pNode;
Printf (" \ n \ t \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * list elements * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n \ n ");
Do
{
Printf (" \ t % d ", TMP - & gt; The data);
TMP=TMP - & gt; Next;
} while (TMP - & gt; Next!=pNode);
Printf (" \ t % d ", TMP - & gt; The data);
Puts (" ");
}
//delete nodes (kill)
Void DeleteNode (node * * pNode, int x, int y)
{
Int people=1;
Int Key [80];
Printf (" please enter the password each in turn (separated by Spaces) : \ n \ n ");
for(int i=1; i<=y; + + I)
{
The scanf (" % d ", & amp; The Key [I]);

}
Printf (" dequeue order: \ n \ n ");
Node * target;
Target=* pNode;
While (people & lt;=y)
{
Node * TMP;
If (people!
=1){
Target=target - & gt; Next;
}
If (x!
=1){
for(int i=1; i{
Target=target - & gt; Next;
}
TMP=target - & gt; Next;
Printf (" % d \ t ", TMP - & gt; The data);//print label delete nodes
X=Key/TMP - & gt; data;
Target - & gt; Next=TMP - & gt; Next;
Free (TMP);
}
The else
{
Printf (" % d \ t ", the target - & gt; The data);
}
People++;
}
}


Int main ()
{
Printf (" Designer by MaLong \ n ");
Printf (" \ n \ t \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" \ n \ \ t t * * ");
Printf (" \ n \ \ t t * * ");
Printf (" \ t \ t * * * * * * * * * * * * * * * * * * * * welcome to Joseph to kill the game * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" \ n \ \ t t * * ");
Printf (" \ n \ \ t t * * ");
Printf (" \ t \ t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n \ n \ n \ n ");
int x,y;
Printf (" please input the number of people involved in the game: \ n ");
The scanf (" % d ", & amp; Y);
Printf (" please enter the initial password: \ n ");
The scanf (" % d ", & amp; x);
The head node *=NULL;
Initialise (& amp; The head, y);
Traversal (head);
DeleteNode (& amp; The head, x, y);
return 0;
}
  • Related