I am having trouble figuring out how to get a user inputted value into a structure I've created to make a linked list of stacks. The structure and pointer info before main() are:
struct inforec
{
int item;
};
struct node;
typedef node *PT_NODE;
struct node
{
inforec info;
PT_NODE next;
};
typedef PT_NODE Stack;
the function and prototype to get a value onto the stack are:
int push(Stack &, inforec &);
int push(Stack & S, inforec & item)
{
cout << "Enter a value to push" << endl;
cout << " " << endl;
cin >> item.item; //THIS IS WHERE I'M HAVING TROUBLE -
PT_NODE P = new node;
P-> info = item;
P-> next = S;
S = P;
}
I can't seem to figure out what the dot operator connects to in order to take the user's input for "item". Can anyone help?
Thanks kindly -