Hello there,
I am trying to make a calculator program. But I have a problem with the negative sign. I fixed the program to do expression of (0-5)+12 if I want 5 to be negative. But I want and I am expecting it to do something like -5+12 .Please help...Thank you in advance

EXAMPLE OUTPUT :
Code:
Enter an infix expression: 
infix: -5+12 
postfix:_5_-_12_+  //'_' this sign is a space , 
error: pop empty stack //so this is wrong
but if I do this:
Code:
Enter an infix expression: 
infix: 5+12 
postfix:5_12_+  //'_' this sign is a space
Answer: 17 //so I succeded here
also, I have a condition:
Code:
case '-': 
         if ((input_string == OPERATOR) || (input_string == '\0') && (input_string== '-'))   
            { 
            return (UNARY); //a minus sign followed by a an operator or null is a unary 
            } 
              
         else 
            { 
            return (OPERATOR); //a minus sign after a number or right parenthesis is a subtraction
            }

so that in converting infix to postfix
Code:
case UNARY:
			push1(input_string[i]);
			break;
and in evaluating a postfix I have in my main:

case '-':
else if ('-' == UNARY) // unary operator
{
//push2(pop2() * (0-1));
push2(pop2() * -1);
}