栈·请问这个C语言代码中,主函数里Push()应该怎么修改?出错在哪里?非常感谢
typedef char DElemtype;typedef struct StackNode
{
DElemtype data;
struct StackNode *next;
}StackNode,*LinkStack;
typedef struct Stack
{
LinkStack top;
int count;
}Stack;
int Push(Stack *s,DElemtype d)
{
LinkStack e=(LinkStack)malloc(sizeof(StackNode));
e->data=d;
e->next=s->top;
s->top=e;
s->count++;
return 1;
}
int mian(){
Stack *s;
DElemtype ch[100];
printf("请输入带有括号的表达式:");
scanf("%s",ch);
char *p=ch;
while(*p)
{
switch(*p){
case '(':
Push(&s,ch);
break;
}}}
警告信息: [Warning] passing argument 1 of 'Push' from incompatible pointer type
[Warning] passing argument 2 of 'Push' makes integer from pointer without a cast