Page 1 of 1

C++ Lunked List - InsertHead HINT: #include typedef int ElemType; typedef struct LNode { ElemType data;

Posted: Fri May 20, 2022 5:45 pm
by answerhappygod
C++ Lunked List - InsertHead
HINT:
#include <iostream>

typedef int ElemType;

typedef struct LNode {
ElemType data;
struct LNode* next;
}LNode, *linkedList;


void showList(linkedList l) {
while (NULL != l) {
printf("%d\n", l->data);
l = l->next;
}
}
C Lunked List Inserthead Hint Include Iostream Typedef Int Elemtype Typedef Struct Lnode Elemtype Data 1
C Lunked List Inserthead Hint Include Iostream Typedef Int Elemtype Typedef Struct Lnode Elemtype Data 1 (29.59 KiB) Viewed 14 times
Description insert an element to the head of the linked list. Multiple elements can be inserted several times UNTIL a 0 is received. Input the elements to be inserted Output the elements just inserted.