Write a function that evaluates an expression in RPN that is given as a string.
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
#define STACK_SIZE 50
// function to perform arithmetic operations
double performOperation(char operation, double operand1, double operand2) {
switch(operation) {
case '+': return operand1 + operand2;
case '-': return operand1 - operand2;
case '*': return operand1 * operand2;
________ _________ ______ ________ _________ ____ ____ _________ ______ ________ _____ ___.
__________ _____ __________ _______ _____ ____ ______.
_________ __________ _______ ____ ____ ______.
________ _______ ______ ______ _____ ________ _____ _________.
_______ __________ __________ ____ _________ ________ _______ _________.
________ __________ _________ _____ _____.
________ ______ _____ _______ ___ _______ ___.
__________ ______ ______ _________ _________ ____ ___.
____ __________ ___ _______ ______ ___ __________.
___ ________ _______ _____ ________ ________ ______ _______ ________ ____.
___ _________ _____ ___ _____ __________ ____ _______ ______.
______ _____ _________ ________ __________ ___ ________ _______ _________ __________ _____.
________ ___ _____ ___ _________ ________ ______ ___ ______ __________ ______ _____.
__________ _____ ___ ______ _______ __________ _________ _______.
__________ ___ ___ ________ _________ _________ _____ ____ ______ ________ _________ _____.
_________ _________ ____ __________ _____.
___ _____ _________ ________ _____ _________ ________ _________ __________ __________.
_______ ________ __________ __________ _____ _______ __________ _______ _________.
_____ _____ ___ _____ _________ ___ _____ __________ ___.
_____ ______ ___ _________ _______ __________ _________.
___ ____ ___ ________ ______.
____ __________ ________ ______ _________ ____ _________ ____ _______ ___.
____ ___ ________ ___ __________ ________ ______ _____ ___.
____ ________ _______ ______ _______.
___ ______ _________ _________ ___ ___ ______ ________ ________ _____.
____ _______ _________ ____ _______ __________ _________ ________ ______ ___ _________.
____ _______ _______ ____ _________ ____ ________.
___ _______ ____ _____ ______ _________ ___ _______ ______ _________ ________.
____ ________ _______ ____ ___ _______ ___ ______ ____ ____ ______ __________.
_________ ___ ___ _______ ________ ______ __________ ________ ________ _______ _______ _________.
__________ _______ _____ _______ _________.
____ ______ ___ _____ __________ ______ ____ _________ _____.
__________ _______ _____ _____ __________ __________ _________ ______.
___ ___ ______ ______ ____ ________ ____.
______ ________ ___ __________ __________ ___ _________.
____ ___ _____ ________ ______ _____.
Get Full Answer on WhatsApp