我这个C程序有什么问题
来源:百度知道 编辑:UC知道 时间:2024/05/02 20:33:46
这个运行不了
#include <stdlib.h>
#include <stdio.h>
#define StackMinSize 20
typedef int Bool;
#define true 1;
#define false 0;
typedef char StackDT;
typedef struct
{
StackDT *base;
int stacksize;
int top;
}Seqstack;
void StackInitialize(Seqstack *pS,int size)
{
if (size<StackMinSize)
size= StackMinSize;
pS->stacksize=size;
pS->base=(StackDT*)malloc(pS->stacksize*sizeof(StackDT));
if (!pS->base)
{exit(EXIT_FAILURE);}
pS->top=-1;
}
Bool StackEmpty(Seqstack S)
{
Bool flag=true;
if (!(S.top==-1))
{flag=false;}
return flag;
}
Bool StackFull(Seqstack S)
{
Bool flag=true;
if (S.top<S.stacksize-1)
flag=false;
return flag;
}
Bool StackGetTop(Seqsta
#include <stdlib.h>
#include <stdio.h>
#define StackMinSize 20
typedef int Bool;
#define true 1;
#define false 0;
typedef char StackDT;
typedef struct
{
StackDT *base;
int stacksize;
int top;
}Seqstack;
void StackInitialize(Seqstack *pS,int size)
{
if (size<StackMinSize)
size= StackMinSize;
pS->stacksize=size;
pS->base=(StackDT*)malloc(pS->stacksize*sizeof(StackDT));
if (!pS->base)
{exit(EXIT_FAILURE);}
pS->top=-1;
}
Bool StackEmpty(Seqstack S)
{
Bool flag=true;
if (!(S.top==-1))
{flag=false;}
return flag;
}
Bool StackFull(Seqstack S)
{
Bool flag=true;
if (S.top<S.stacksize-1)
flag=false;
return flag;
}
Bool StackGetTop(Seqsta
正确:
#include <stdlib.h>
#include <stdio.h>
#define StackMinSize 20
typedef int Bool;
#define true 1;
#define false 0;
typedef char StackDT;
typedef struct
{
StackDT *base;
int stacksize;
int top;
}Seqstack;
void StackInitialize(Seqstack *pS,int size)
{
if (size<StackMinSize)
size= StackMinSize;
pS->stacksize=size;
pS->base=(StackDT*)malloc(pS->stacksize*sizeof(StackDT));
if (!pS->base)
{exit(EXIT_FAILURE);}
pS->top=-1;
}
Bool StackEmpty(Seqstack S)
{
Bool flag=true;
if (!(S.top==-1))
{flag=false;}
return flag;
}
Bool StackFull(Seqstack S)
{
Bool flag=true;
if (S.top<S.stacksize-1)
flag=false;
return flag;
}
Bool StackGetTop(Seqstack S,StackDT *pd)
{
Bool flg=true