Why is “int” used before main instead of double for more precision? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

30th Sep 2018, 4:21 PM
Gokuthebestsaiyan
Gokuthebestsaiyan - avatar
2 Answers
+ 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 😊
30th Sep 2018, 4:33 PM
Anna
Anna - avatar
+ 2
Thanks! I thought it refered to the precision of the output.
30th Sep 2018, 4:34 PM
Gokuthebestsaiyan
Gokuthebestsaiyan - avatar