Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Postfix evaluation algorithm implementation More...
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
Data Structures | |
struct | Stack |
for printf() and scanf() More... | |
Functions | |
void | push (int8_t opd) |
Function to push on the stack. More... | |
int8_t | pop () |
Function to pop from the stack. More... | |
int8_t | evaluate (char post[]) |
Function to evaluate postfix expression. More... | |
static void | test () |
Self-test implementations. More... | |
int | main () |
Main function. More... | |
Variables | |
struct Stack | st |
global declaration of stack st | |
Postfix evaluation algorithm implementation
The input postfix expression is of type string upto 49 characters (including space delimiters). Supported operations- '+', '-', '/', '*', ''
int8_t evaluate | ( | char | post[] | ) |
Function to evaluate postfix expression.
post | the input postfix expression |
int main | ( | void | ) |
Main function.
initialize
run self-test implementations
int8_t pop | ( | void | ) |
Function to pop from the stack.
< to store the popped value to be returned
void push | ( | int8_t | opd | ) |
|
static |
Self-test implementations.
this ensures that the algorithm works as expected
this ensures that the algorithm works as expected