Language: C

include <stdio.h>
#define MAX 10000

int initialize();
int isEmpty();
int isFull();
int push(int x);
int pop(int x);

int top=0;
int S[MAX];

int main(){
	int a,b;
	char str[MAX];
	initialize();
	while(scanf("%s",str)!=EOF){
		if(str[0]='+'){
			a=pop();
			b=pop();
			push(a+b);
		}else if(str[0]='-'){
			a=pop();
			b=pop();
			push(a-b);
		}else if(str[0]='*'){
			a=pop();
			b=pop();
			push(a*b);
		}else{
			push(atoi(str));
		}
		printf("%d\n",pop());
		return 0;
	}


}

int initialize(){
	top=0;
}

int isEmpty(){
	return top==0;
}

int isFull(){
	return top >= MAX-1;
}

void push(int x){
	if(isFull()) return -1;
	top++;
	S[top]=x;
}

int pop(){
	if(isEmpty()) return -1;
	top--;
	return S[top+1];
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:16:9: error: implicit declaration of function 'initialize' [-Wimplicit-function-declaration]
   16 |         initialize();
      |         ^~~~~~~~~~
main.c:17:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   17 |         while(scanf("%s",str)!=EOF){
      |               ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:17:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   17 |         while(scanf("%s",str)!=EOF){
      |               ^~~~~
main.c:17:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:17:32: error: 'EOF' undeclared (first use in this function)
   17 |         while(scanf("%s",str)!=EOF){
      |                                ^~~
main.c:17:32: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:17:32: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:27: error: too few arguments to function 'pop'
   19 |                         a=pop();
      |                           ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c:20:27: error: too few arguments to function 'pop'
   20 |                         b=pop();
      |                           ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c:23:27: error: too few arguments to function 'pop'
   23 |                         a=pop();
      |                           ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c:24:27: error: too few arguments to function 'pop'
   24 |                         b=pop();
      |                           ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c:27:27: error: too few arguments to function 'pop'
   27 |                         a=pop();
      |                           ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c:28:27: error: too few arguments to function 'pop'
   28 |                         b=pop();
      |                           ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c:31:30: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
   31 |                         push(atoi(str));
      |                              ^~~~
main.c:33:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   33 |                 printf("%d\n",pop());
      |                 ^~~~~~
main.c:33:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:33:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:31: error: too few arguments to function 'pop'
   33 |                 printf("%d\n",pop());
      |                               ^~~
main.c:8:5: note: declared here
    8 | int pop(int x);
      |     ^~~
main.c: At top level:
main.c:52:6: error: conflicting types for 'push'; have 'void(int)'
   52 | void push(int x){
      |      ^~~~
main.c:7:5: note: previous declaration of 'push' with type 'int(int)'
    7 | int push(int x);
      |     ^~~~
main.c: In function 'push':
main.c:53:29: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   53 |         if(isFull()) return -1;
      |                             ^
main.c:52:6: note: declared here
   52 | void push(int x){
      |      ^~~~
main.c: In function 'pop':
main.c:58:1: error: number of arguments doesn't match prototype
   58 | int pop(){
      | ^~~
main.c:8:5: error: prototype declaration
    8 | int pop(int x);
      |     ^~~