Language: C++

#include <stdio.h>
#define STACK_SIZE 100
#define MAX 100

int stack[STACK_SIZE];
int stack_size = 0;

int pop()
{
	if (stack_size <= 0) return 0;
	return stack[--stack_size];
}

int push(int a)
{
	stack[stack_size++] = a;
}

int is_digit(char *s)
{
	if (*s == '+' || *s =='-') {
		s++;
		if (*s >= '0' && *s <= '9') return 1;
		return 0;
	}
	if (*s >= '0' && *s <= '9') return 1;
	return 0;
}

int get_number(char *s)
{
	int sign = 0, n = 0;
	
	if (*s == '+') {
		s++;
	} else if (*s == '-') {
		sign = 1;
		s++;
	}
	while (*s >= '0' && *s <= '9') {
		n = n * 10 + (*s - '0');
		s++;
	}
	if (sign) return -n;
	return n;
}

int calc_rpn(char *s)
{
	int a, b, n;
	
	while (*s) {
		if (is_digit(s)) {
			n = get_number(s);
			push(n);
			while (*s == '-' || *s == '+') {
						s++;
			}
		} else {
			switch (*s) {
			case '+':
				a = pop();
				b = pop();
				push(b+a);
				break;
			case '-':
				a = pop();
				b = pop();
				push(b-a);
				break;
			case '*':
				a = pop();
				b = pop();
				push(b*a);
				break;
			case '/':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b/a);
				break;
			case '%':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b%a);
			}
			s++;
		}
	}
	return pop();
}

int main()
{
	char s[MAX];
	scanf("%[^\n]*s", s);
	printf("%d\n",calc_rpn(s));
}
		s++;
			}
			while (n) {
							s++;
			}
		} else {
			switch (*s) {
			case '+':
				a = pop();
				b = pop();
				push(b+a);
				break;
			case '-':
				a = pop();
				b = pop();
				push(b-a);
				break;
			case '*':
				a = pop();
				b = pop();
				push(b*a);
				break;
			case '/':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b/a);
				break;
			case '%':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b%a);
			}
			s++;
		}
	}
	return pop();
}

int main()
{
	char s[MAX];
	scanf("%[^\n]*s", s);
	printf("%d\n",calc_rpn(s));
}
	n /= 10;
        s++;
			}
		} else {
			switch (*s) {
			case '+':
				a = pop();
				b = pop();
				push(b+a);
				break;
			case '-':
				a = pop();
				b = pop();
				push(b-a);
				break;
			case '*':
				a = pop();
				b = pop();
				push(b*a);
				break;
			case '/':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b/a);
				break;
			case '%':
				a = pop();
				b = pop();
				if (a == 0) break;
				push(b%a);
			}
			s++;
		}
	}
	return pop();
}

int main()
{
	char s[MAX];
	scanf("%[^\n]*s", s);
	printf("%d\n",calc_rpn(s));
}

Compiler output:
a.cc: In function 'int push(int)':
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
a.cc: At global scope:
a.cc:100:17: error: 's' does not name a type
  100 |                 s++;
      |                 ^
a.cc:101:25: error: expected declaration before '}' token
  101 |                         }
      |                         ^
a.cc:102:25: error: expected unqualified-id before 'while'
  102 |                         while (n) {
      |                         ^~~~~
a.cc:105:17: error: expected declaration before '}' token
  105 |                 } else {
      |                 ^
a.cc:105:19: error: expected unqualified-id before 'else'
  105 |                 } else {
      |                   ^~~~
a.cc:136:9: error: expected declaration before '}' token
  136 |         }
      |         ^
a.cc:137:9: error: expected unqualified-id before 'return'
  137 |         return pop();
      |         ^~~~~~
a.cc:138:1: error: expected declaration before '}' token
  138 | }
      | ^
a.cc:140:5: error: redefinition of 'int main()'
  140 | int main()
      |     ^~~~
a.cc:94:5: note: 'int main()' previously defined here
   94 | int main()
      |     ^~~~
a.cc:146:9: error: 'n' does not name a type
  146 |         n /= 10;
      |         ^
a.cc:147:9: error: 's' does not name a type
  147 |         s++;
      |         ^
a.cc:148:25: error: expected declaration before '}' token
  148 |                         }
      |                         ^
a.cc:149:17: error: expected declaration before '}' token
  149 |                 } else {
      |                 ^
a.cc:149:19: error: expected unqualified-id before 'else'
  149 |                 } else {
      |                   ^~~~
a.cc:180:9: error: expected declaration before '}' token
  180 |         }
      |         ^
a.cc:181:9: error: expected unqualified-id before 'return'
  181 |         return pop();
      |         ^~~~~~
a.cc:182:1: error: expected declaration before '}' token
  182 | }
      | ^
a.cc:184:5: error: redefinition of 'int main()'
  184 | int main()
      |     ^~~~
a.cc:94:5: note: 'int main()' previously defined here
   94 | int main()
      |     ^~~~