With Structures & Arrays ...
void push(stack *ps, int x)
{ if (ps -> top ==STACKSIZE -1)
{ cout << “Stack Overflow”;
}
else
{ (ps -> top) ++;
ps -> items[ps -> top] = x;
}
}
Consider using a class and arrays.
What about classes and linked lists?
Previous slide
Next slide
Back to first slide
View graphic version