Hi everyone, I've worked on this thing for about three days now and am really getting frustrated. I need to make a stack using linear linked lists of arrays. I've got my class to compile without complaining, but am really struggling with the function definitons of push and peek. Any help would be greatly appreciated. Here is what I have so far:
//function to "push", move data to the stack
void Stack::push(char newItem[])
{
//create new node
node *newPtr = new node;
assert(newPtr != NULL);
newPtr->item = newItem;
//inserts new node
newPtr->next = topPtr;
topPtr = newPtr;
}
//function to return the top item in stack
void Stack::peek(char stackTop[]) const
{
stackTop[] = topPtr->item;
}