On submitting my code,i am getting [SIGSEGV] error.I am not able to find the cause of this error
my code is given below
#include<iostream>
#include<stack>
#include<string.h>
#include<string>
using namespace std;
int main()
{
int T=0;
char str[600];
string out;
stack<char> rStack;
scanf("%d",&T);
while(T--)
{
out= "";
int j=1;
scanf("%s",str);
int slen = strlen(str);
for(int i=0;i<slen;i++)
{
switch (str[i])
{
case '(':
rStack.push(str[i]);
break;
case '+':
{ if(!rStack.empty())
check : if(rStack.top()=='-' || rStack.top()=='*' || rStack.top()=='/' || rStack.top()=='^')
{
out += rStack.top();
rStack.pop();
goto check;
}//end if
rStack.push('+');
//cout<<"rstacki "<<rStack.top();
break;
}//case +
case '-':
{
if(!rStack.empty())
check1 : if(rStack.top()='+' || rStack.top()=='*' || rStack.top()=='/' || rStack.top()=='^')
{
out += rStack.top();
rStack.pop();
goto check1;
}//end if
rStack.push('-');
break;
}//case -
case '*':
{
if(!rStack.empty())
check2 : if(rStack.top()=='/' || rStack.top()=='^')
{
out += rStack.top();
rStack.pop();
goto check2;
}//end if
rStack.push('*');
break;
}//case *
case '/':
{
if(!rStack.empty())
check3 : if( rStack.top()=='*' || rStack.top()=='^')
{
out += rStack.top();
rStack.pop();
goto check3;
}//end if
rStack.push('/');
break;
}//case /
case '^':
{
rStack.push('^');
break;
}//case ^
case ')':
{
if(!rStack.empty())
while(rStack.top()!='(')
{
if(!rStack.empty()){
out+=rStack.top();
rStack.pop();}
}
// cout<<"r ( top "<<rStack.top()<<" i is \n"<<j;
if(!rStack.empty())
rStack.pop();
break;
}//case )
default:
out += str[i];
break;
}//end switch
}//end for
// cout<<rStack.empty();
while(!rStack.empty())
{
out +=rStack.top();
rStack.pop();
}
cout<<out<<endl;
}//end while
//system("pause");
return 0;
}