#include<bits/stdc++.h> using namespace std;
int prefixEvalution(string chk){ stackst;
for(int i=chk.length()-1;i>=0;i--){
if(chk[i]>='0' && chk[i]<='9'){
st.push(chk[i]-'0');
}
else{
**int a=st.pop();
int b=st.pop();**
switch(chk[i]){
case '+':
st.push(a+b);
break;
case '-':
st.push(a-b);
break;
case '*':
st.push(a*b);
break;
case '/':
st.push(a/b);
break;
case '^':
st.push(pow(a,b));
break;
default:
break;
}
}
}
return st.top();
}
Here compiler shows an error for "int a= st.pop();" and says "void value not ignored as it ought to be ". I don't know why?