Okay, brilliant. Now its popping almost correctly now all I think it needs is a quick modification on how it makes
the topPtr point to the second node in the stack but I don't know if its in pop() or push() where the error occurs..
Code so far
Code:
char pop( StackNodePtr *topPtr ){
//Pop a value off the stack.
char data;
StackNode *temp;
temp = *topPtr;
data = temp->data;
printf(" %c \n", data);
*topPtr = temp -> nextPtr;
free(temp);
return data;
}
Code:
void push( StackNodePtr *topPtr, char value ){
//Push a value on the stack.
//The seperate top pointer makes this more complicated.
StackNode *newNode;
newNode = malloc(sizeof(StackNode));
newNode -> data = value;
newNode -> nextPtr = *topPtr;
*topPtr = newNode;
}