请高手帮忙!!关于栈的
#include "stdio.h"#define max 100
struct stack
{
int data[max];
int top;
};
void init(struct stack *p)
{
p->top=-1;
}
void push(struct stack *q,int i)
{
if(q->top==max-1)
printf("strack is full\n");
else q->top++;
q->data[q->top]=i;
}
int pop(struct stack *h)
{ return (h->data[h->top--]);
}
void main()
{
struct stack *s;
int a ;
init(s);
push(s,4);
push(s,3);
push(s,2);
while(1)
{
if(s->top==-1)break;
printf("%d ", (a=pop(s)));
}
getchar();
}搞了好久了,还是无法运行