70,023
社区成员




#include<stdio.h>
#include<stdlib.h>
typedef int ElemType;
typedef int Status;
typedef struct stacknode
{
ElemType data;
struct stacknode *next;
}stacknode;
typedef struct stacklink
{
stacknode *top;
ElemType stacklength;
}stacklink;
Status Initstack(stacklink *s)
{
s->top=(struct stacknode*)malloc(sizeof(struct stacknode));
if(!s->top)
return 0;
s->top->data=0;
s->top->next=NULL;
s->stacklength=0;
return 1;
}
int main(int argc, char *argv[])
{
stacklink *mystack;
if(Initstack(mystack))
printf("ok\n");
else
printf("error");
system("PAUSE");
return 0;
}