Language: C

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

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:21:1: error: unknown type name 'stack_t'
   21 | stack_t *stack_create(const size_t len)
      | ^~~~~~~
main.c: In function 'stack_create':
main.c:24:3: error: unknown type name 'stack_t'
   24 |   stack_t *stack = (stack_t *)malloc(sizeof(stack_t));
      |   ^~~~~~~
main.c:24:21: error: 'stack_t' undeclared (first use in this function); did you mean 'stack'?
   24 |   stack_t *stack = (stack_t *)malloc(sizeof(stack_t));
      |                     ^~~~~~~
      |                     stack
main.c:24:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:30: error: expected expression before ')' token
   24 |   stack_t *stack = (stack_t *)malloc(sizeof(stack_t));
      |                              ^
main.c:31:8: error: request for member 'data' in something not a structure or union
   31 |   stack->data = data;
      |        ^~
main.c:32:8: error: request for member 'size' in something not a structure or union
   32 |   stack->size = 0;
      |        ^~
main.c:33:8: error: request for member 'max_len' in something not a structure or union
   33 |   stack->max_len = len;
      |        ^~
main.c: At top level:
main.c:37:20: error: unknown type name 'stack_t'
   37 | void stack_destroy(stack_t *const stack)
      |                    ^~~~~~~
main.c:45:29: error: unknown type name 'stack_t'
   45 | size_t stack_get_size(const stack_t *const stack)
      |                             ^~~~~~~
main.c: In function 'stack_get_size':
main.c:51:15: error: request for member 'size' in something not a structure or union
   51 |   return stack->size;
      |               ^~
main.c: At top level:
main.c:54:17: error: unknown type name 'stack_t'
   54 | bool stack_push(stack_t *const stack, const int32_t data)
      |                 ^~~~~~~
main.c:69:16: error: unknown type name 'stack_t'
   69 | bool stack_pop(stack_t *const stack, int32_t *const data)
      |                ^~~~~~~
main.c:89:37: error: unknown type name 'stack_t'
   89 | static int32_t stack_pop_with_check(stack_t *const stack)
      |                                     ^~~~~~~
main.c:101:38: error: unknown type name 'stack_t'
  101 | static int32_t stack_push_with_check(stack_t *const stack, int32_t data)
      |                                      ^~~~~~~
main.c: In function 'main':
main.c:116:3: error: unknown type name 'stack_t'
  116 |   stack_t *s = stack_create(STACK_SIZE);
      |   ^~~~~~~
main.c:120:19: error: implicit declaration of function 'stack_pop_with_check' [-Wimplicit-function-declaration]
  120 |       int32_t a = stack_pop_with_check(s);
      |                   ^~~~~~~~~~~~~~~~~~~~
main.c:122:7: error: implicit declaration of function 'stack_push_with_check' [-Wimplicit-function-declaration]
  122 |       stack_push_with_check(s, a - b);
      |       ^~~~~~~~~~~~~~~~~~~~~
main.c:132:18: error: implicit declaration of function 'stack_push' [-Wimplicit-function-declaration]
  132 |       bool ret = stack_push(s, atoi(str));
      |                  ^~~~~~~~~~
main.c:137:3: error: implicit declaration of function 'stack_destroy' [-Wimplicit-function-declaration]
  137 |   stack_destroy(s);
      |   ^~~~~~~~~~~~~