스 택(Stack)

■ 스택의 배열 구현

[ 스택 생성 ]

struct create_stack(unsigned int max_elements)
{
           STACK S;
/*1*/   S=(STACK) malloc(sizeof(struct stack_record));
/*2*/   s->array=(int*)
                 malloc(sizeof(int) * max_elements);
/*3*/   S->top=EMPTY_TOS;
/*4*/   S->capacity=max_elements;
            return(S);
}