1>빌드 시작: 2015-04-04 오전 3:24:31
1>InitializeBuildStatus:
1> "Debug\형남이.unsuccessfulbuild"에 연결(touching)하고 있습니다.
1>ClCompile:
1> 형남이.cpp
1>c:\users\administrator\documents\visual studio 2010\projects\형남이\형남이\형남이.cpp(46): error C3861: 'exit': 식별자를 찾을 수 없습니다.
1>c:\users\administrator\documents\visual studio 2010\projects\형남이\형남이\형남이.cpp(61): error C3861: 'exit': 식별자를 찾을 수 없습니다.
1>
1>빌드하지 못했습니다.
1>
1>경과 시간: 00:00:00.17
========== 빌드: 성공 0, 실패 1, 최신 0, 생략 0 ==========
#include <stdio.h>
#include <malloc.h>
typedef int element;
typedef struct StackNode{
element item;
struct StackNode *link;
} StackNode;
typedef struct{
StackNode *top;
}LinkedStackType;
void init(LinkedStackType *s)
{
s->top = NULL;
}
int is_empty(LinkedStackType *s)
{
return (s->top==NULL);
}
int is_full(LinkedStackType *s)
{
return 0;
}
void push(LinkedStackType *s, element item)
{
StackNode *temp=(StackNode *)malloc(sizeof(StackNode));
if(temp==NULL){
fprintf(stderr, "메모리 할당에러\n");
return;
}
else{
temp->item = item;
temp->link = s->top;
s->top = temp;
}
}
element pop(LinkedStackType *s)
{
if(is_empty(s)){
fprintf(stderr, "스택이 비어있음\n");
exit(1);
}
else{
StackNode *temp=s->top;
element item = temp->item;
s->top =s->top->link;
free(temp);
return item;
}
}
element peek(LinkedStackType *s)
{
if(is_empty(s)){
fprintf(stderr, "스택이 비어있음\n");
exit(1);
}
else{
return s->top->item;
}
}
void main()
{
LinkedStackType s;
init(&s);
push(&s,1);
push(&s,2);
push(&s,3);
printf("%d\n",pop(&s));
printf("%d\n",pop(&s));
printf("%d\n",pop(&s));
printf("%d\n",is_empty(&s));
}
exit 식별자정의를
어디다가 해야하는거에요?
여기저기 찾아봐도 뭔소리인지 모르겠어서요.. ㅜㅜ