배열 스택


배열 스택

#include #include #define MAX_STACK_SIZE 100 typedef int Element; Element data[MAX_STACK_SIZE]; int top; void error(const char str[]) { printf("%s\n", str); exit(1); } void init_stak() { top = -1; } int is_empty() { return top == -1; } int is_full() { return top == MAX_STACK_SIZE - 1; } int size() { return top + 1; } void push(Element e) { if (is_full) error("스택 포화 에러"); data[++top] = e; } Eleme..


원문링크 : 배열 스택