Language: C

int pop(int *);
int isFull(void);

int top=0;

int main(){
  
  int x,data[2];
  int a[100];
  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'|| s[0]=='-'||s[0]=='*'){
       data[0]=pop(a);
       data[1]=pop(a);
    }

      if(s[0]=='+'){
	push(data[1]+data[0],a);

     }else if(s[0]=='-'){
	push(data[1]-data[0],a);
  
     }else if(s[0]=='*'){
	push(data[1]*data[0],a);

     }else {
	 x = atoi(s);
         push(x,a);
     }
    } 
   printf("%d",a[1]);
  return 0;
}


int isFull(void){
  if(top>=99)return 0;
  else return 1;
 }

void push(int x,int *a){
  if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
  else top++;
  a[top]=x;
}

int pop(int *a){
  if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
  else top--;
  return a[top+1];
}
 

Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   while(scanf("%s",s)!=EOF){
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int pop(int *);
main.c:12:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   while(scanf("%s",s)!=EOF){
      |         ^~~~~
main.c:12:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:12:24: error: 'EOF' undeclared (first use in this function)
   12 |   while(scanf("%s",s)!=EOF){
      |                        ^~~
main.c:12:24: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:12:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:9: error: implicit declaration of function 'push' [-Wimplicit-function-declaration]
   19 |         push(data[1]+data[0],a);
      |         ^~~~
main.c:28:14: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
   28 |          x = atoi(s);
      |              ^~~~
main.c:32:4: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   32 |    printf("%d",a[1]);
      |    ^~~~~~
main.c:32:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:4: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:32:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:42:6: warning: conflicting types for 'push'; have 'void(int,  int *)'
   42 | void push(int x,int *a){
      |      ^~~~
main.c:19:9: note: previous implicit declaration of 'push' with type 'void(int,  int *)'
   19 |         push(data[1]+data[0],a);
      |         ^~~~
main.c: In function 'push':
main.c:43:20: error: implicit declaration of function 'fprintf' [-Wimplicit-function-declaration]
   43 |   if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
      |                    ^~~~~~~
main.c:43:20: note: include '<stdio.h>' or provide a declaration of 'fprintf'
main.c:43:20: warning: incompatible implicit declaration of built-in function 'fprintf' [-Wbuiltin-declaration-mismatch]
main.c:43:20: note: include '<stdio.h>' or provide a declaration of 'fprintf'
main.c:43:28: error: 'stderr' undeclared (first use in this function)
   43 |   if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
      |                            ^~~~~~
main.c:43:28: note: 'stderr' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c: In function 'pop':
main.c:49:20: warning: incompatible implicit declaration of built-in function 'fprintf' [-Wbuiltin-declaration-mismatch]
   49 |   if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
      |                    ^~~~~~~
main.c:49:20: note: include '<stdio.h>' or provide a declaration of 'fprintf'
main.c:49:28: error: 'stderr' undeclared (first use in this function)
   49 |   if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
      |                            ^~~~~~
main.c:49:28: note: 'stderr' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'