I keep getting an error when using option 2. Could someone please point me in the right direction.
#include <iostream>
using namespace std;
int num;
int Size;
int choice;
int *currentArray = 0;
int *tempArray = 0;
int index, oldSize, newSize;
struct nodeType
{
int info;
nodeType *Link;
};
nodeType *Head, *current, *newNode;
void PUSH(int num)
{
newNode = new nodeType;
newNode->info = num;
newNode->Link = NULL;
newNode->Link = Head;
Head = newNode;
newNode = NULL;
}
void POP(int num)
{
current = Head;
current->Link = current->Link->Link;
Head->Link = NULL;
newNode = NULL;
}
int main()
{
while(choice != 3)
{
cout<<"Press 1 to PUSH and 2 to POP and 3 is to exit";
cout<<"\n";
cin>>choice;
Size = 0;
if(choice ==1)
{
PUSH(num);
Size = Size +1;
cout<<"you have"<<"\n\n"<<Size<<"slots in your array"<<"\n\n";
}
if(choice ==2)
{
POP(num);
Size = Size -1;
cout<<"you have"<<"\n\n"<<Size<<"slots in your array"<<"\n\n";
}
}
}