Skip to content

Instantly share code, notes, and snippets.

@raju249
Created July 21, 2015 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raju249/458d68e2c623ee6f3492 to your computer and use it in GitHub Desktop.
Save raju249/458d68e2c623ee6f3492 to your computer and use it in GitHub Desktop.
// main entry point for program
int main(void)
{
int c;
do
{
// print instructions
printf("\nMENU\n\n"
"1 - delete\n"
"2 - insert\n"
"3 - search \n"
"4 - traverse\n"
"0 - quit\n\n");
// get command
printf("Command: ");
c = GetInt();
// try to execute command
switch (c)
{
case 1: delete(); break;
case 2: insert(); break;
case 3: search(); break;
case 4: traverse(); break;
}
}
while (c != 0);
// free list before quitting
node* ptr = first;
while (ptr != NULL)
{
node* predptr = ptr;
ptr = ptr->next;
free(predptr);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment