いまどき最大値が決めうちのスタックなんて誰も使わねーよ
そういうプログラムを書く人が多いからC言語は使いづらいってイメージが広まるんだよ

>>761
#include <stdio.h>
#include <stdlib.h>
// 最初に確保するサイズ。最大サイズではない
#define DEF_SIZE 100

typedef struct {
char *data;
int length;
int allocated;
} Stack;

void init(Stack *stack){
stack->data = (char *) malloc(sizeof(char) * DEF_SIZE);
stack->length = 0;
stack->allocated = DEF_SIZE;
}

void push(char c, Stack *stack){
if (++stack->length > stack->allocated){
stack->data = (char *) realloc(stack->data, sizeof(char) * (stack->length));
}
stack->data[stack->length - 1] = c;
}
char pop(Stack *stack){
return stack->data[--stack->length];
}