+ 1
wt s the use of return 0
6 ответов
+ 3
Every type function must return a value. If you use void main() you need not use "return 0;" as the last statement of main function.
But if the type of main function is other than "void" it must return that type of value, i.e. int main() must return integer value, float main() must return float value, etc. and since 0 can be returned as any data type, we generally use return 0.
0
When you create a main function, you specify its return type as an int (void main is not allowed by both the C standard and C++ standard). Technically can return any integer value that you want, but if I recall correctly, some compilers use the 0 return value to signify that the program ran successfully.
0
it's a good programming practice to indicate to the OS that your program has successfully executed ... if the program is not executed successfully then it will return garbage value
- 1
thnks
- 1
it means finish
- 1
thnks