user-0 提问: 请大神帮我看看哪里有问题，为何得不出正确的答案，没有人帮我，希望我能走桃花运碰到好人！

回复:
user: user-1
content: #include <stdio.h> #include <stdlib.h> #define MAX_SIZE 1024  void InsertNum_Stack(int *Num_Stack,int *Top_Num,int num); void InsertChar_Stack(char *Char_Stack,int *Top_char,char num); int Decide(char *Char_Stack,int *Top_char,char num); void Deal_date(char *Char_Stack,int *Num_Stack,int *Top_char,int *Top_num);   int main() {     int Num_Stack[MAX_SIZE] = {0};     int Top_Num = -1;     char Char_Stack[MAX_SIZE] = {0};                                                           //符号栈初始化；     int Top_char = -1;     char *temp,dest[10];                                                                        //数据暂存；     char *str = NULL;     int num = 0,i;      str = (char *)malloc(MAX_SIZE*sizeof(char));     if (!str) {         printf("申请存储空间失败！\n");         exit(0);     }     printf("请输入要运算的公式(包括等号)：");     scanf("%s",str);     while(*str != '='){         temp = dest;         while(*str >= '0'&& *str <= '9'){             *temp = *str;             temp++;             str++;         }         if(*str != '(' && *(temp-1) != '\0'){             *temp = '\0';             num = atoi(dest);             InsertNum_Stack(Num_Stack,&Top_Num,num);         }         while(*str == '+'||*str == '-'||*str == '*'||*str == '/'||*str == '('||*str == ')'||*str == '='){             i = Decide(Char_Stack,&Top_char,*str);                                             //优先级判断；             if(i == 0){                 InsertChar_Stack(Char_Stack,&Top_char,*str);                                   //字符压栈；                 break;             }             else if(i == 1){                 str++;             }             else if(i == -1){                 Deal_date(Char_Stack,Num_Stack,&Top_char,&Top_Num);                             //数据处理；                 if(*str == '=')                     break;             }         }         if(*str != '=')             str++;     }     printf("结果 = %d\n",Num_Stack[0]);     return 0; }  void InsertNum_Stack(int *Num_Stack,int *Top_Num,int num) {     (*Top_Num)++;     printf("Top num = %d\n", *Top_Num);      Num_Stack[*Top_Num] = num;      return; }  void InsertChar_Stack(char *Char_Stack,int *Top_char,char num){     (*Top_char)++;     Char_Stack[*Top_char] = num;     return; }  int Decide(char *Char_Stack,int *Top_char,char num) {     if(*Top_char == -1||num == '('||(Char_Stack[*Top_char] == '('&&Char_Stack[*Top_char] != ')'))         return 0;     else if((Char_Stack[*Top_char] == '+'||Char_Stack[*Top_char] =='-')&&(num == '*'||num == '/'))         return 0;     else if(Char_Stack[*Top_char] == '('&&num == '(')         return 0;     else if((Char_Stack[*Top_char] == '(' && num == '+')||num == '-'||num == '*'||num == '/')         return 0;     else if(Char_Stack[*Top_char] == '('&&num == ')'){         Top_char--;         return 1;     }     else         return -1; }  void Deal_date(char *Char_Stack,int *Num_Stack,int *Top_char,int *Top_num){     int num_1 = Num_Stack[*Top_num];     int num_2 = Num_Stack[*Top_num-1];     int value = 0;     if(Char_Stack[*Top_char] == '+')         value = num_1 + num_2;     else if(Char_Stack[*Top_char] == '*')         value = num_1 * num_2;     else if(Char_Stack[*Top_char] == '/')         value = num_2 / num_1;     else if(Char_Stack[*Top_char] == '-')         value = num_2 - num_1;     (*Top_num)--;     //Num_Stack[*Top_num] == value;     Num_Stack[*Top_num] = value;     Top_char--;     return; }  改了之后上面的代码，可以运行不带括号的，但是还是100以内的运算 加上括号就会有问题，建议继续查找问题。 其实可以看一下别人是怎么处理的，可以拿别人的源码分析一下

user: user-2
content: 程序里bug很多，比如;  void InsertNum_Stack(int *Num_Stack,int *Top_Num,int num){ *(Top_Num)++; Num_Stack[*Top_Num] = num; return; }  void InsertChar_Stack(char *Char_Stack,int *Top_char,char num){ *(Top_Num)++; Char_Stack[*Top_char] = num; return;  } 这两个函数中下面这两行应该把*移到括号里面，类似的bug还有 *(Top_Num)++; *(Top_Num)++;  另外，算法也有问题，计算表达式的值多看看编译原理中的算符优先算法。

user: user-3
content: 有没有调试信息发出来看看？