+ 1

Who will call the return 0 statement ?

#include<stdio.h> int main(){ int a=10,b=10,c; c=a+b; printf("the value is",c); return 0; }

30th May 2017, 4:56 AM
Gokulakrishnan M
Gokulakrishnan M - avatar
3 odpowiedzi
+ 10
Whoever calls main(), will receive the return value. Since your programs are initiated by your operating system, the return statement returns value 0 back to your OS to signal that the program has run successfully. If your program crashes, the return value will not be 0. P.S. It's <stdio.h> * or <cstdio> btw.
30th May 2017, 5:23 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
the return 0 is called when everything else is done in the program, so returning zero will say "false" for the main function, meaning to finish the program. Also, the printf should have %d, or %i betweeen the strings, to show the data from var c.
30th May 2017, 5:05 AM
Welliton Malta
Welliton Malta - avatar
0
because that question asked by one person in my technical interview ... who will call the return..
30th May 2017, 5:10 AM
Gokulakrishnan M
Gokulakrishnan M - avatar