0

why return 0; is outside the loop?

array

27th Jun 2016, 5:14 AM
Devi Hota
7 Respuestas
+ 1
a question is given to print the array elements.in this question why we should take return 0 outside the for loop?
27th Jun 2016, 5:29 AM
Devi Hota
+ 1
thats partially true...return 0 means when the computer 'reads' return 0 it goes back from where the function was called ...with the value 0. In case of main()...the computer or more precisely the control goes back to the console on which your program was running. that is why if you run any program on pc the last thing you see is "program exited with code 0" or something similar If you talk about functions other than main () (user defined functions) then the control returns back to the point where the corresponding function was called.
27th Jun 2016, 5:53 AM
Mukul Kumar
Mukul Kumar - avatar
0
which program are you referring to please be more specific
27th Jun 2016, 5:16 AM
Mukul Kumar
Mukul Kumar - avatar
0
this q/a section is common so , selecting discussion from anywhere will post your question here on one single place...so actually it is difficult to know what you are asking but i think i get it.
27th Jun 2016, 5:37 AM
Mukul Kumar
Mukul Kumar - avatar
0
then please explain why
27th Jun 2016, 5:39 AM
Devi Hota
0
Now to get your answer please tell me what do you understand by 'return 0'?
27th Jun 2016, 5:41 AM
Mukul Kumar
Mukul Kumar - avatar
0
return 0 means the end of a program.
27th Jun 2016, 5:43 AM
Devi Hota