int apply_unary_function(number (*function)(number), Stack* stack) {
number operand;
if (empty_stack(*stack))
return 0;
operand = pop_stack(stack);
push_stack(stack, (*function)(operand));
destroy_number(operand);
return 1;
}
int main() {
char command_line[1000];
char* command_to_parse;
char* token;
Stack number_stack = create_stack();
while (1) {
printf("Please enter a postfix expression:\n");
command_to_parse =
fgets(command_line, sizeof (command_line), stdin);
if (command_to_parse = NULL)
return 0;
token = strtok(command_to_parse, " \t\n");
command_to_parse = 0;
while (token != 0) {
if (isdigit(token[0]))
push_stack(&number_stack, string_to_number(token));
else if (((strcmp(token, "+ ") == 0) &&
!apply_binary_function(&add, &number_stack)) ||
((strcmp(token, "-") == 0) &&
!apply_binary_function(&subtract, &number_stack)) ||
((strcmp(token, "*") == 0) &&