First data structure program linked list inserted, print

xiaoxiao2021-03-06  47

// linktest.cpp: defines the entry point for the console application.///

#include "stdafx.h" #include

Typedef struct _node {int val; structure; node, * pnode;

Void LQ_INSERT (PNODE P, INT X) // Insert a new node after the P node, q = new node; Q-> Val = x; Q-> link = P-> link; p-> link = Q ;

} void LQ_PRINT (PNODE P) {pnode q = p; while (q) {cout << q-> val << "; q = Q-> link;} cout << endl;}

INT main (int Argc, char * argv []) {node head; pnode phet = & head; pnode p = pead; PHEAD-> VAL = 0; PHEAD-> LINK = NULL; for (int i = 1; i <10 i ) {LQ_INSERT (P, I); P = P-> Link;} lq_print (pHEAD); Printf ("Hello World! / N"); return 0;}

转载请注明原文地址:https://www.9cbs.com/read-91302.html

New Post(0)