Skip to content

Instantly share code, notes, and snippets.

@H4niz
Created March 23, 2018 05:24
Show Gist options
  • Save H4niz/852e0bc0fe1c1383ef0b8a10bb35fcbc to your computer and use it in GitHub Desktop.
Save H4niz/852e0bc0fe1c1383ef0b8a10bb35fcbc to your computer and use it in GitHub Desktop.
int eval(int Sign, int *Pool) {
int bufSign;
bufSign = Sign;
if(bufSign == '+' ) {
Pool->value[ Pool->num-2 ] = Pool->value[ Pool->num-2 ] + Pool->value[ Pool->num-1 ];
}
else if (bufSign == '-') {
Pool->value[ Pool->num-2 ] = Pool->value[ Pool->num-2 ] - Pool->value[ Pool->num-1 ];
}
else if (bufSign == '*') {
Pool->value[ Pool->num-2 ] = Pool->value[ Pool->num-2 ] * Pool->value[ Pool->num-1 ];
}
else if (bufSign == '/') {
Pool->value[ Pool->num-2 ] = Pool->value[ Pool->num-2 ] / Pool->value[ Pool->num-1 ];
}
Pool->num--; //Pool.num[ Pool.num ] = Pool.num-1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment