Language: C

#define MAXVAL 100

int sp = 0;
double val[MAXVAL];

/* push: fを値スタックにプッシュする*/
void push(double f)
{
	if (sp < MAXVAL)
		val[sp++] = f;
	else
		printf("error: stack full, can't push %g\n", f);
}

/* pop: スタックをポップし，一番上の値を返す*/
double pop(void)
{
	if (sp > 0)
		return val[--sp];
	else {
		printf("error: stack empty\n");
		return 0.0;
	}
}

#include <ctype.h>

int getch(void);
void ungetch(int);

/* getop:　次の演算子あるいは数値の被演算数をとってくる*/
int getop(char s[])
{
	int i, c;

	while ((s[0]= c = getch()) == ' ' || c == '\t')
		;
	s[1] = '\0';
	if (!isdigit(c) && c != '.')
		return c;	/*　cは数ではない */
	i = 0;
	if (isdigit(c)) /*　整数部を集める　*/
		while (isdigit(s[++i] = c = getch()))
			;
	if (c == '.') /*　小数部を集める　*/
		while (isdigit(s[++i] = c = getch()))
			;
	s[i] = '\0';
	if (c != EOF)
		ungetch(c);
	return NUMBER;
}

#define BUFSIZE 100

char buf[BUFSIZE];
int bufp =0;

int getch(void) /* 1文字を取ってくる */
{
	return (bufp > 0) ? buf[--bufp] : getchar();
}

void ungetch(int c) /* 文字を入力に戻す */
{
	if (bufp >= BUFSIZE)
		printf("ungetch: too many characters\n");
	else
		buf[bufp++] = c;
}


Compiler output:
main.c: In function 'push':
main.c:12:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   12 |                 printf("error: stack full, can't push %g\n", f);
      |                 ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #define MAXVAL 100
main.c:12:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   12 |                 printf("error: stack full, can't push %g\n", f);
      |                 ^~~~~~
main.c:12:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'pop':
main.c:21:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   21 |                 printf("error: stack empty\n");
      |                 ^~~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'getop':
main.c:49:18: error: 'EOF' undeclared (first use in this function)
   49 |         if (c != EOF)
      |                  ^~~
main.c:49:18: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:49:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:51:16: error: 'NUMBER' undeclared (first use in this function)
   51 |         return NUMBER;
      |                ^~~~~~
main.c: In function 'getch':
main.c:61:43: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
   61 |         return (bufp > 0) ? buf[--bufp] : getchar();
      |                                           ^~~~~~~
main.c:61:43: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c: In function 'ungetch':
main.c:67:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   67 |                 printf("ungetch: too many characters\n");
      |                 ^~~~~~
main.c:67:17: note: include '<stdio.h>' or provide a declaration of 'printf'