Why, if I write
int main()
{
//...
}
do I not need to write return 0; at the end of the main function? Do
Basically, yes. Functions are not required to return anything, even if they declare a return type other than void. The value returned will be undefined.
Note that C99 requires that functions that declare non-void return types always terminate by hitting a return statement. So if you were compiling using your compiler's C99 mode this code would result in a compile-time error.