this assignment is due tonite, i have a small glitch
here's the code:

#include <stdio.h>
#include <stdlib.h>

struct node {
int value;
struct node *next;
};

struct node *first = NULL;
struct node *new_node;
void push( int input_value);
int pop();
void instructions(void);
void printlist();
main()
{
int input, value, number, lv;

instructions();
printf("?");
scanf("%d", &input);
while (input != 0) {
switch (input) {
case 1:
printf("Enter an integer: ");
scanf("\n%d", &number);
push(number);
printlist();
break;
case 2:
pop();
break;
default:
printf("Invalid choice.\n\n");
break;
}
printf("?");
scanf("%d", &input);
}
printf("End of run.\n");
return 0;
}

void push( int input_value)
{
new_node = malloc(sizeof(struct node));
new_node->value = input_value;
new_node->next = first;
first = new_node;
}

int pop()
{
struct node *n;
int lv;
if (lv == NULL)
printf("List is empty");
else
n = first; /* or n = first */
first = first->next; /* or first = " " */
lv = n->value;
printf(" %d returned\n", lv);
free( n );
}

void instructions (void)
{
printf("Enter your choice:\n"
" 0 to end program.\n"
" 1 to add a value to the list.\n"
" 2 to remove a value from the list.\n");
}

void printlist()
{
if (free == NULL)
printf("List is empty.\n\n");
else {
printf("The list is:\n");

while (new_node != NULL) {

printf("%d --> ", new_node->value);
new_node = new_node->next;
}


printf("NULL\n\n");
}
}


here's the glitch, I want to print "list is empty" after everything is popped off.

admiral% gcc stack2.c
admiral% a.out
Enter your choice:
0 to end program.
1 to add a value to the list.
2 to remove a value from the list.
?1
Enter an integer: 4
The list is:
4 --> NULL

?1
Enter an integer: 5
The list is:
5 --> 4 --> NULL

?2
5 returned
?2
4 returned
?2
Segmentation Fault (core dumped)