Original question from Quora:

Can I use bool data type with main function?

My Answer:

You shouldn’t use a bool data type with a main function. Even if the compiler lets you, it’s a bad idea.

The reason main is supposed to return an integer is that UNIX systems use return values in programs as signals. So, you return 0 if program is successful and a positive integer if there was an error of some kind. That way you can use the return value to debug the error.

In practice, the standard return value is 0. So, just return 0 and work on writing the rest of your program.


P.S. Have you subscribed to Code Career Genius yet?