Ok, I am trying this with your help QuestionC.
I am getting a problem though.
this is my input and output after compilation as it is now:
22 /accounts/student2/srbkpk/STACK/PR5 a.out
Please enter a line of text to be printed in reverse:How are you doing?
??????????????????
here's the source file
Code:
/******************/
/* stacka.c */
/******************/
#include <stdlib.h>
#include "stack.h"
int top;
int str[MAX_SIZE];
int count;
void make_empty()
{
str[0] = NULL;
count = 0;
}
int is_empty(void)
{
return count == 0;
}
int is_full(void)
{
return 0;
}
void push(int insert_value)
{
top++;
str[top]=insert_value;
count++;
}
int pop(void)
{
int i;
if (is_empty()) {
printf("Error in pop: stack is empty.\n");
exit (EXIT_FAILURE);
}
i = str[top];
count--;
return i;
}
void print_list()
{
int i;
if (str[i] == NULL) {
printf("List is empty.\n\n");
}
else {
printf("\n\nHere is your list: \n");
for (i=0;i<=top;i++)
printf("%c\n",str[i]);
return;
}
}