Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linked List
//Title of this code //gcc 4.9.2 #include<stdlib.h> #include<stdio.h> #include<string.h> typedef struct cell cell; struct cell{ char*key; cell*next; }; void insert_list(char*key,cell**list){ if(*list==NULL){ *list=(cell*)malloc(sizeof(cell)); (*list)->key=(char*)malloc(sizeof(char)*(strlen(key)+1)); strcpy((*list)->key,key); (*list)->next=NULL; } else if(strcmp(key,(*list)->key)) insert_list(key, &((*list)->next)); } void print(cell*list){ if(list!=NULL){printf("%s\t",list->key);print(list->next);} } int main(){ cell*list=NULL; insert_list("Kevin",&list); insert_list("Parfait",&list); insert_list("Ahmet",&list); print(list); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
selection sort
Project 5 v.01
Pointer arithmatic
lab5!
No warnings!!!
Atoi without minus
C/Assembly
02468
Program 1 - 2D array and memory pointers
Working except for the thread part. LUL
Please log in to post a comment.