Code:
struct stackNode **xstack;
push(xstack, 5);
push(xstack, 5);
printf("%d %d", pop(xstack), pop(xstack));
u have just defined a stacknode pointer,that pointer needs to point somewhere, so use something like this:
Code:
struct stackNode xstack;
struct stackNode* xstack_p;
xstack_p = &xstack;
push(&xstack_p, 5);
push(&xstack_p, 5);
printf("%d %d", pop(&xstack_p), pop(&xstack_p));
}
use this.
for two stacks
Code:
struct stackNode xstack;
struct stackNode* xstack_p;
xstack_p = &xstack;
struct stackNode ystack;
struct stackNode* ystack_p;
ystack_p = &ystack;