What about the problem of "no matching symbolic information found"in this function?
Code:
The code:
#include<stdio.h>
#include<stdlib.h>
#define MaxSize 50
char postexp[MaxSize];
typedef struct{
char elem[MaxSize];
int top;}SqStack;
void InitStack(SqStack *&s)
{s=(SqStack *)malloc(sizeof(SqStack));
s->top=-1;}
int push(SqStack *&s,char e)
{if(s->top==MaxSize-1) return 0;
s->top++;
s->elem[s->top]=e;
return 1;}
void trans(char *exp)
{SqStack *s;int i=0;
while(*exp!='\0')
{switch(*exp)
{case '(':push(s,*exp);exp++;break;
case ')':while(s->elem[s->top]!='(')
{postexp[i++]=s->elem[s->top];
s->top--;}
s->top--;exp++;break;
case '*':
case '/':if(s->elem[s->top]=='*'||s->elem[s->top]=='/')
postexp[i++]=s->elem[s->top];
s->top--;push(s,*exp);exp++;break;
case '+':
case '-':while(s->top!=-1&&s->elem[s->top]!='(')
{postexp[i++]=s->elem[s->top];s->top--;}
push(s,*exp);exp++;break;
case ' ':exp++;break;
default:while(*exp>='0'&&*exp<='9')
{postexp[i++]=*exp;exp++;}
postexp[i++]='#';}}
while(s->top!=-1)
{postexp[i++]=s->elem[s->top];
s->top--;}
postexp[i]='\0';
}
void main()
{SqStack *s;char exp[]="2+3*4/(5+6)";
InitStack(s);
trans(exp,postexp);
gets(postexp);
}
Compile with VC seems OK
but the running process throws exception,
and debug information as follows:
Loaded symbols for 'H:\Visual C++ 6.0\新建文件夹\MSDev98\MyProjects\EXP\Debug\EXP.exe'
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0xF08 has exited with code 0 (0x0).
How dizzy I am to find out the problem .Any friend can help me?