Hello all... again,
I'm trying to write a function that will "simulate" the stack. Here's what I have so far...
int i = 0;
int arraySize;
char * stack[100];
void stackPush(char * pushed)
{
if(i == 100)
{
cout << "ERROR: Stack overflow!";
}
else
{
stack[i] = pushed;
for(int x = 0; x <= i; x++)
{
cout << stack[x] << endl;
}
i++;
}
}
The only problem is, when you "push" something onto this stack, it writes it to THE ENTIRE STACK. I've tried making it only write to one element (the "stack" part), but it still writes to the entire thing. I know this is a trivial question, but my GoogleFu and mind are failing me right now. Help?