hi jsut need a little help editing this new to forum and hope to stay around heard this is the best one around ,
i want to use arrays eg house
dog
cat
only problem is i can only use stdio.h
when cat is entered a second time it pops off the list ??
ive started building the stack but can only do it with numbers if anyone can edit this for me will be a great help
all the best dave
Code:
#include <stdio.h>
#include<ctype.h>
# define MAXSIZE 200
int stack[MAXSIZE];
int top; //index pointing to the top of stack
void push(int y)
{
if(top>MAXSIZE)
{
printf("STACK FULL");
return;
}
else
{
top++;
stack[top]=y;
}
}
int pop()
{
int a;
if(top<=0)
{
printf("STACK EMPTY");
return 0;
}
else
{
a=stack[top];
top--;
}
return(a);
}
int main()
{
void push(int);
{
int pop();
int i,num;
int value;
{
{
do {
printf("Enter value: ");
scanf("%d", &value);
if(value !=0) push(value);
else printf("value on top is %d\n", pop());
} while(value != -1);
return 0;
}
system("PAUSE");
return 0;
}
}
}