EXIT_SUCCESS
, EXIT_FAILURE
추천 자료: ASP.NET Core 인증 및 권한 부여
필수 헤더 파일
#include <stdlib.h>
설명
EXIT_SUCCESS
및 EXIT_FAILURE
상수는 main
함수의 반환값으로 사용됩니다.
상수 | 정의된 값 |
---|---|
EXIT_SUCCESS |
0 |
EXIT_FAILURE |
1 |
return 0;
를 return EXIT_SUCCESS;
로 변경하기
코드: exit_success.c
#include <stdio.h>
#include <stdlib.h> // EXIT_SUCCESS, EXIT_FAILURE
int main(void)
{
printf("Hello\n");
return EXIT_SUCCESS; // return 0;
}
Hello
C:\C_Challenge\Challenge\x64\Debug\Challenge.exe (process 11520) exited with code 0.
Press any key to close this window . . .
#include <stdio.h>
#include <stdlib.h> // EXIT_SUCCESS, EXIT_FAILURE
int main(void)
{
printf("Hello\n");
return EXIT_FAILURE;
}
Hello
C:\C_Challenge\Challenge\x64\Debug\Challenge.exe (process 12312) exited with code 1.
Press any key to close this window . . .
EXIT_SUCCESS 전역 상수 사용해보기
추천 자료: .NET Blazor에 대해 알아보시겠어요? .NET Blazor 알아보기를 확인해보세요!