Language: C

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct stack_tag struct_t;
 
struct stack_tag {
  int32_t *data;
  size_t max_len;
  size_t size;
};

static bool check_is_null(const void *const p)
{
  if (p == NULL) {
    return true;
  }

  return false;
}

stack_t *stack_create(const size_t len)
{
  int32_t *data = (int32_t *)malloc(sizeof(int32_t) * len);
  stack_t *stack = (stack_t *)malloc(sizeof(stack_t));

  if (check_is_null(data) || check_is_null(stack)) {
    perror("memory is full\n");
    exit(1);
  }

  stack->data = data;
  stack->size = 0;
  stack->max_len = len;
  return stack;
}

void stack_destroy(stack_t *const stack)
{
  if (stack != NULL) {
    free(stack->data);
    free(stack);
  }
}

size_t stack_get_size(const stack_t *const stack)
{
  if (check_is_null(stack)) {
    return 0;
  }

  return stack->size;
}

bool stack_push(stack_t *const stack, const int32_t data)
{
  if (check_is_null(stack)) {
    return false;
  }

  if (stack->max_len <= stack->size) {
    return false;
  }

  stack->data[stack->size] = data;
  stack->size++;
  return true;
}

bool stack_pop(stack_t *const stack, int32_t *const data)
{
  if (check_is_null(stack)) {
    return false;
  }

  if (stack->size < 1) {
    return false;
  }

  stack->size--;
  *data = stack->data[stack->size];

  return true;
}

#if !defined(TEST)
#define STACK_SIZE 256
#define BUF_SIZE 128

static int32_t stack_pop_with_check(stack_t *const stack)
{
  int32_t data;
  bool ret = stack_pop(stack, &data);
  if (!ret) {
    perror("stack is full");
    exit(1);
  }

  return data;
}

static int32_t stack_push_with_check(stack_t *const stack, int32_t data)
{
  bool ret = stack_push(stack, data);
  if (!ret) {
    perror("stack is full\n");
    exit(1);
  }

  return data;
}

int32_t main(void)
{
  char str[BUF_SIZE];

  stack_t *s = stack_create(STACK_SIZE);

  while (scanf("%s", str)) {
    if (str[0] == '-') {
      int32_t a = stack_pop_with_check(s);
      int32_t b = stack_pop_with_check(s);
      stack_push_with_check(s, a - b);
    } else if (str[0] == '+') {
      int32_t a = stack_pop_with_check(s);
      int32_t b = stack_pop_with_check(s);
      stack_push_with_check(s, a + b);
    } else if (str[0] == '*') {
      int32_t a = stack_pop_with_check(s);
      int32_t b = stack_pop_with_check(s);
      stack_push_with_check(s, a * b);
    } else {
      bool ret = stack_push(s, atoi(str));
      if (!ret) goto err;
    }
  }

  stack_destroy(s);

  return 0;

err:
  perror("stack is full\n");
  exit(1);
}
#endif

Compiler output:
main.c:23:1: error: unknown type name 'stack_t'
   23 | stack_t *stack_create(const size_t len)
      | ^~~~~~~
main.c: In function 'stack_create':
main.c:26:3: error: unknown type name 'stack_t'
   26 |   stack_t *stack = (stack_t *)malloc(sizeof(stack_t));
      |   ^~~~~~~
main.c:26:21: error: 'stack_t' undeclared (first use in this function); did you mean 'stack'?
   26 |   stack_t *stack = (stack_t *)malloc(sizeof(stack_t));
      |                     ^~~~~~~
      |                     stack
main.c:26:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:30: error: expected expression before ')' token
   26 |   stack_t *stack = (stack_t *)malloc(sizeof(stack_t));
      |                              ^
main.c:33:8: error: request for member 'data' in something not a structure or union
   33 |   stack->data = data;
      |        ^~
main.c:34:8: error: request for member 'size' in something not a structure or union
   34 |   stack->size = 0;
      |        ^~
main.c:35:8: error: request for member 'max_len' in something not a structure or union
   35 |   stack->max_len = len;
      |        ^~
main.c: At top level:
main.c:39:20: error: unknown type name 'stack_t'
   39 | void stack_destroy(stack_t *const stack)
      |                    ^~~~~~~
main.c:47:29: error: unknown type name 'stack_t'
   47 | size_t stack_get_size(const stack_t *const stack)
      |                             ^~~~~~~
main.c: In function 'stack_get_size':
main.c:53:15: error: request for member 'size' in something not a structure or union
   53 |   return stack->size;
      |               ^~
main.c: At top level:
main.c:56:17: error: unknown type name 'stack_t'
   56 | bool stack_push(stack_t *const stack, const int32_t data)
      |                 ^~~~~~~
main.c:71:16: error: unknown type name 'stack_t'
   71 | bool stack_pop(stack_t *const stack, int32_t *const data)
      |                ^~~~~~~
main.c:91:37: error: unknown type name 'stack_t'
   91 | static int32_t stack_pop_with_check(stack_t *const stack)
      |                                     ^~~~~~~
main.c:103:38: error: unknown type name 'stack_t'
  103 | static int32_t stack_push_with_check(stack_t *const stack, int32_t data)
      |                                      ^~~~~~~
main.c: In function 'main':
main.c:118:3: error: unknown type name 'stack_t'
  118 |   stack_t *s = stack_create(STACK_SIZE);
      |   ^~~~~~~
main.c:122:19: error: implicit declaration of function 'stack_pop_with_check' [-Wimplicit-function-declaration]
  122 |       int32_t a = stack_pop_with_check(s);
      |                   ^~~~~~~~~~~~~~~~~~~~
main.c:124:7: error: implicit declaration of function 'stack_push_with_check' [-Wimplicit-function-declaration]
  124 |       stack_push_with_check(s, a - b);
      |       ^~~~~~~~~~~~~~~~~~~~~
main.c:134:18: error: implicit declaration of function 'stack_push' [-Wimplicit-function-declaration]
  134 |       bool ret = stack_push(s, atoi(str));
      |                  ^~~~~~~~~~
main.c:139:3: error: implicit declaration of function 'stack_destroy' [-Wimplicit-function-declaration]
  139 |   stack_destroy(s);
      |   ^~~~~~~~~~~~~