C语言 链式栈 括号匹配

用的CB 结果不对 代码哪里有问题呢

#include<stdio.h>
#include<stdlib.h>
int item;

struct node{
char bracket;
struct node* next;};

int judge(char c0,char c)
         {
             if(c==')'&&c0=='('||c=='}'&&c0=='{'||c==']'&&c0=='[')
                return 1;
             else return 0;
         }

void in_struct (char b,struct node* head)
{  struct node*q=(struct node*)malloc(sizeof(struct node));
   q->bracket=b;
   q->next=head;
   head=q;
}

void out_struct(struct node*head)
{
   if(head==NULL)
      printf("has been empty,right bracket left");
   else{item=head->bracket;
        struct node*t=head->next;
        free(head);
        head=t;
        }
}

int main(){

struct node*head=(struct node*)malloc(sizeof(struct node));
char ch;
ch=getchar();
head->bracket=ch;
head->next=NULL;


ch=getchar();
while(ch!='#')
{
    if("ch=='('||ch=='{'||ch=='['")
        in_struct(ch,head);

    else if("ch==')'||ch=='}'||ch==']'")
    {
       if(judge(head->bracket,ch)==1)
          out_struct(head);
       else {printf("unmatched");
              exit(0);}

    }
ch=getchar();
}


if(head->bracket=='('||'{'||'[')
    printf("left bracket left");
 else   printf("succeed");

return 0;

}

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^