- #1
Mikeyjoe512
- 1
- 0
Mod note: please use [noparse]
[/noparse] tags around your code, to preserve your indentation and improve readability. I have done this to your code.
I'm using DEV C++ for my class and I have to use infix and postfix in my STACK. The sign is that has to be in infix and post fix is : //
Code:
and
I'm using DEV C++ for my class and I have to use infix and postfix in my STACK. The sign is that has to be in infix and post fix is : //
Code:
#include <stdio.h>
#include <stdlib.h>
//STACK
struct node
{
char *info;
node *next;
};
node *top;
void push(node *n)
{
if(top == NULL)
{
top = n;
return;
}
n->next = top;
top = n;
}
node *pop()
{
if(top == NULL) return NULL;
node *temp;
temp = top;
top = top->next;
return temp;
}
bool isEmpty()
{
return (top == NULL);
}
int main()
{
//top = NULL;
//push(new node("Michael"));
//push(new node("Justin"));
//printf("%s\n", pop()->info);
//push(new node("Saundra"));
//push(new node("Jerry"));
//while(!isEmpty())
//{
// printf("%s\n", pop()->info);
//}
system("pause");
return 0;
}
Last edited by a moderator: