I have write a program that simulates a calculator. One of the operations the calculator has to do is the inclusive OR | (bitwise operator). It should also work for positive and negative numbers.
Would this work??
case '|':
op1 = pop(); //op1 and op2 are of type double
op2 = pop();
if( op1 == '-' && isdigit(op2) )
push( (int)op1 | (int)op2);
I also have to convert the these valves (op1 and op2) to int type is the that the correct way?