스물두줄

스택을 생성하고 노드를 받아들일 수 있게 준비하는 AS_CreateStack()함수는 다음과 같이 구현하였…

정보관리기술사 제102회(2014년) 4교시 4-6번 · 25점

스택을 생성하고 노드를 받아들일 수 있게 준비하는 AS_CreateStack()함수는 다음과 같이 구현하였다. 다음 함수를 완성하시오. 가. 삽입(push) 함수 (아래 void AS_Push(AS *Stack, ElementType Data)) 나. 제거(pop) 함수 (아래 ElementType AS_Pop(AS *Stack)) typedef int ElementType; typedef struct tagNode { ElementType Data; } Node; typedef struct tagArrayStack { int Capacity; int Top; Node *Nodes; } AS; void AS_CreateStack(AS *Stack, int Capacity) { (*Stack) = (AS *)malloc(sizeof(AS)); (*Stack)->Nodes = (Node *)malloc(sizeof(Node)*Capacity); (*Stack)->Capacity = Capacity; (*Stack)->Top=0; } void AS_DestroyStack(AS *Stack) { free(Stack->Nodes); free(Stack); } void AS_Push(AS *Stack, ElementType Data) { } ElementType AS_Pop(AS *Stack) { }

모범답안 목차 AI 작성 · 사람 검수 전

소제목만 공개합니다. 본문과 도식은 앱에서 확인할 수 있습니다.