how can i translate this to C program?
FOR each character (say ch) in the valid expression DO
if ch is a digit
if stack is not full
number = ch-48
push the character's number into the stack
else
print stack overflow message and exit the program
else if current_ch is one of the operators
if stack has less than 2 numbers in it {
print error message, and exit
else
pop 2 numbers from stack
Call compute two numbers with the operator
push result back into stack
end if
end if
END-FOR
On exit from the above FOR loop:
if stack is empty OR has more than 1 number in it
print error message and exit
else
pop final result from stack
print final result
}
FOR each character (say ch) in the valid expression DO
if ch is a digit
if stack is not full
number = ch-48
push the character's number into the stack
else
print stack overflow message and exit the program
else if current_ch is one of the operators
if stack has less than 2 numbers in it {
print error message, and exit
else
pop 2 numbers from stack
Call compute two numbers with the operator
push result back into stack
end if
end if
END-FOR
On exit from the above FOR loop:
if stack is empty OR has more than 1 number in it
print error message and exit
else
pop final result from stack
print final result
}