EXIT_SUCCESS, EXIT_FAILURE

  • 2 minutes to read

필수 헤더 파일

#include <stdlib.h>

설명

EXIT_SUCCESSEXIT_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 전역 상수 사용해보기

https://youtu.be/Q0cJ2zQbN1I

VisualAcademy Docs의 모든 콘텐츠, 이미지, 동영상의 저작권은 박용준에게 있습니다. 저작권법에 의해 보호를 받는 저작물이므로 무단 전재와 복제를 금합니다. 사이트의 콘텐츠를 복제하여 블로그, 웹사이트 등에 게시할 수 없습니다. 단, 링크와 SNS 공유, Youtube 동영상 공유는 허용합니다. www.VisualAcademy.com
박용준 강사의 모든 동영상 강의는 데브렉에서 독점으로 제공됩니다. www.devlec.com