반응형
stack 소스
-
[자료구조] 기본 Stack 소스Programming/자료구조&알고리즘 2014. 3. 18. 03:14
스택 소스 입니다. #include #include // 스택 크기 #define STACK_MAX (5) // 스택 선언 int arr[STACK_MAX]; int top = -1; void push(int data) { arr[++top] = data; } int pop() {return arr[top--]; } int is_full() { return top == STACK_MAX-1; } int is_empty() { return top == -1; } // 스택 출력 void display() { int i; system("cls"); // 콘솔창 초기화 printf("\n"); for(i = 0; i top) printf("..