In the main function, I had a lot of error testing code to make sure I successfully located and opened some files. So since I did that a lot, I made it a separate, void, function. When I previously had "return EXIT_FAILURE" in the main function it would work just like I wanted it to. But when I put it in a secondary function I named errorTest, it gets on me about returning something after declaring it a void function. So, what class is "EXIT_FAILURE", so I can differently declare that void function into returning whatever class "EXIT_FAILURE" is?
(and yes, I included the library cstdlib)
It's a preprocessor macro defined by #include <cstdlib>
.
It expands to an integral constant expression. This is not necessarily of type int
, however it must have a value within the valid range of int
so that it can be passed to exit()
.
it's an integer. Declare your function as int.
EXIT_FAILURE是在stdlib.h
(或cstdlib
)中声明的int
,因此它是原始类型,而不是类。
EXIT_SUCCESS
和EXIT_FAILURE
是在stdlib.h
或cstdlib
定义的宏。
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.