Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
带头结点的单链表
//g++ 7.4.0 // 带头结点的单链表 #include<stdio.h> typedef int ElemType; typedef struct LNode{ ElemType data; struct LNode *next; }LNode, *LinkList; bool InitList(LinkList &L) { L = (LNode *)malloc(sizeof(LNode)); if (L==NULL) return false; L->next = NULL; return true; } bool Empty(LinkList L) { return L->next == NULL; } LNode * GetElem(LinkList L, int i) { int j = 1; LNode *p = L->next; if(i==0) return L; if(i<1) return NULL; while(p!=NULL && j<i) { p = p->next; j++; } return p; } void test() { LinkList L; InitList(L); } int main() { test(); return 0; }
run
|
edit
|
history
|
help
0
Peg Grammar AST Parser Computer Language Interpreter
Ternary operator - warnings about unsued values
Newspaper
DailyGroceryHisto
cppPyFoodVatTip
swastic
Test
inorder traversal
Preference List
Exempel 2