게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
(본삭금)하다하다 뭔소린지 모르겟어서요
게시물ID : programmer_9118짧은주소 복사하기
작성자 : df3ef
추천 : 0
조회수 : 1259회
댓글수 : 1개
등록시간 : 2015/04/04 15:30:12
옵션
  • 본인삭제금지
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 식별자정의를
 
어디다가 해야하는거에요?
여기저기 찾아봐도 뭔소리인지 모르겠어서요.. ㅜㅜ
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호