int main() { list *head=(list *)malloc(sizeof(list)); head=NULL; int n,i; printf("How many elements\n"); scanf("%d",&n); printf("Inserting the elements in the list.\n"); for(i=1; i<=n; i++) { if(!(InsertBegin(&head, i))) printf("Insertion Failed\n"); } printf("Printing List...\n"); PrintList(head); return 0; }
int main(){ int option = 999; char *menuStr = getScrOp(); while(option!=11){ printf("%sEnter an Option :",menuStr); scanf("%d",&option); switch(option){ case 1: insert(); break; case 10: display(); break; case 2: InsertBegin(); break; case 3: InsertAnywhere(); break; case 11: printf("Exited."); break; case 4: deleteNode(); break; case 5: countIteratively(); break; case 6: getNth(); break; case 7: searchIteratively(); break; case 8: searchRecursively(head,getInput()); break; case 9: swapByLinks(); break; default : printf("Enter an valid option"); } } return 0; }