+ 2
C++ challenges
int main without return 0 is a valid code ? can I post a screen copy of this cases ?
3 Réponses
+ 15
int main() does not require an explicit return 0.
If the return value is not given, the compiler automatically understands the return value as 0
+ 10
Although it isn't required to explicitly return 0, it's encouraged to. Just saying.
+ 4
Normally in functions, if you declare it with a return value, you have to return something that matches that data type. For example:
char getRandChar() {
//Some code
return 'a'; //If this wasn't here, it would give an error.
}