简体   繁体   中英

Why can't I use EXIT_SUCCESS instead of 0 in the return statement in Visual Studio Code?

Why can't I use EXIT_SUCCESS instead of 0 in the return statement in Visual Studio Code? I get the error:

id "EXIT_SUCCESS" is not defined

#include <stdio.h>

int main(void)
{
    puts("Thanks for help");
    return EXIT_SUCCESS; /*problem*/
}

The definitions of the EXIT_SUCCESS and EXIT_FAILURE macros are in the "stdlib.h" header file, so you need to #include <stdlib.h> in order to use them.

(Some compilers may implicitly include that header when you include "stdio.h" but you can't rely on that behaviour.)

因为EXIT_SUCCESS位于stdlib.h而您没有包含它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM