+ 1
Why is “int” used before main instead of double for more precision?
Wouldn’t double be more precise? Or does this data type declaration refer to something else?
2 Antworten
+ 5
int refers to the return type of the main function. Usually the main function ends with return 0. That means that 0 is returned to the OS, telling the OS (or the calling program) that the program was executed/ended successfully. If it returns a number other than 0, it means that there was some kind of error. There's only a couple of error codes that are really used, so there isn't really that much precision needed 😊
+ 2
Thanks! I thought it refered to the precision of the output.