I am an advanced beginner c I am given a stack/push/pop assignement to do but I have no clue on how to do it. The book that I have sucks in explaining stacks and old threads in here are too complicated or advanced for me right now.
I am given this outline to go by:
Code:
for(;;)
{
fgets(command,sizeof(command), stdin);
if(feof(stdin))break;
if(command[0]=='p') push atoi (command+1) onto stack
if(command[0]=='w') pop number from stack
display contents of the stack
}
So I I want to ad 5678 to a stack I have to be able to write at the command: p 5678 or w 5678 to remove it from the stack
Please need help!!