0
Process finished with exit code-1
Iam getting like this in output plz help me
3 odpowiedzi
0
Here is a link referring to Exit Codes
https://documentation.arcanadev.com/adtempus/help/2.0/notes/Exit_Codes.htm#:~:text=Whenever%20a%20program%20runs%2C%20it,return%20a%20meaningful%20exit%20code.
You may wish to share the details of your problem and which language to gain a better answer
0
#include <stdio.h>
//Compiler version gcc 6.3.0
void push(int);
int pop();
int stack[20];
int top=-1;
void push(int x)
{
stack[++top]=x;
}
int pop()
{
return stack[top--];
}
int main()
{
char exp[20];
char *e;
int n1,n2,n3,num;
printf("enter ur expression");
//scanf("%s",exp);
gets(exp);
e=exp;
while(e!='\0')//for(e=0;e<=20;e++)
{
if(isdigit(*e))
{
num=*e-48;
push(num);
}
else
{
n1=pop();
n2= pop();
switch(*e)
{
case '+':n3= n1+n2;
break;
case '-':n3=n1-n2;
break;
case '*':n3=n1*n2;
break;
case '/':n3=(n1)/(n2);
break;
}
push(n3);
}
e++;
}
printf("ans is:%d",pop());
return 0;
getch();
}
0
This is the code for post fix expression in c language if u are free plz crct the code error is exit code -11