What is the difference between return 0 in the end of main code and return 0 in the end of function code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between return 0 in the end of main code and return 0 in the end of function code

in return 0 ,0 which means the code is successfully compiled but in functions return 0 means it returns value zero why this is happening

16th Aug 2018, 2:15 PM
Kondepati Bhavana
1 Answer
+ 1
It has integer return type therefore it has to return something at the end , hence we use 'return 0' statement at the end of the function. If you usemain() function as an int i.e. Integer type then return(0) is used in program to return a value which will be an integer
18th Aug 2018, 3:09 PM
Mayur Shedage
Mayur Shedage - avatar