直接return true;了
当然还有一些其他问题,大概修改如下
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct linknode{
int data;
struct linknode *next;
}*listack;
listack stack_headinsert(){//头插法建立链栈
listack s;int e;int x;
listack L;
scanf("%d",&e);
L=(listack)malloc(sizeof(listack));
L->data=e;
L->next=NULL;
scanf("%d",&x);
while(x!=9999){
s=(listack)malloc(sizeof(listack));
s->data=x;
s->next=L->next;
L->next=s;
scanf("%d",&x);
}
return L;
}
bool insteadstack(listack L,int x){
listack p=L;
if(L==NULL)
return false;
else
L->data=x;
printf("栈顶数据元素%d",L->data);
return true;
}
int main(){
listack L;
L = stack_headinsert();
insteadstack(L,6);
}