+ 4

Do you know when we return 0 or any value from main() function where does it actually returns to

30th Apr 2017, 2:23 AM
Mohit Rawat
Mohit Rawat - avatar
3 odpowiedzi
+ 16
The value is returned to your operating system.
30th Apr 2017, 2:43 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Hatsy rei i also feel the same the value goes to os which tells the processor that if program is successful executed or not, well i am not very much sure about this as this is documented no where
30th Apr 2017, 5:30 AM
Mohit Rawat
Mohit Rawat - avatar
+ 1
Technically, in C or C++ main function has to return a value because it is declared as int main which means main function should return integer data type if main is declared as void no need for 0 0 just means no errors and is discarded.
30th Apr 2017, 2:30 AM
James
James - avatar