程序运行不了,
这是个栈的程序:
#include <stdio.h>
#include <malloc.h>
struct list{
int data;
struct list *next;
};
struct stract{
struct list *top;
struct list *bot;
};
int data;
sturct stract stack;
void inits(struct stract s){
struct list *b;
b=(struct list *)malloc(sizeof(struct list));
b->next=null;
s.top=b;
s.bot=b;
}
void push(struct stract s,int a){
struct list *b;
b=(struct list *)malloc(sizeof(struct list));
b->next=s.top;
s.top=b;
b->data=a;
}
void pop(struct stract s,int a){
struct list *b;
b=s.top;
s.top=s.top->next;
a=b->data;
}
int gettop(struct stract s){
return s.top->data;
}
main(){
inits(stack);
push(stack,1);
println("%d",gettop(stack));
}