I am writing a small program to convert a number into base 2/8/16.
The requirements are to create the stack without using class, just use an array, a pointer to hold subscript and the stack will have push and pop functions including empty and full check.
So the question is how do I create a stack without using class, and where should I implement the calculations in `push()` and print in `pop()` as well as the checkEmpty and checkFull. Thanks
The requirements are to create the stack without using class, just use an array, a pointer to hold subscript and the stack will have push and pop functions including empty and full check.
So the question is how do I create a stack without using class, and where should I implement the calculations in `push()` and print in `pop()` as well as the checkEmpty and checkFull. Thanks
int main()
{
const int SIZE = 100;
int stack[SIZE];
int *p; // subscript pointer to the stack
// assign address of stack to pointer
p = stack;
return 0;
}
// function to insert at the top of stack
void push (int *p, int stack[], int size, int newData)
{
}
// function to pop the function
int pop (int *p, int stack[], int size)
{
// return top most element
}