I’m a beginner CSE student and I have a question about how the return
statement works.
For the code:
#include <stdio.h>
int main()
{
int a,b;
printf("Enter a's Value n");
scanf("%d",&a);
printf("Enter b's Value n");
scanf("%d",&b);
printf("Sum of numbers is %d",a+b);
}
The output is:
Enter a's Value
23
Enter b's Value
62
Sum of numbers is 85
--------------------------------
Process exited after 2.972 seconds with return value 20
Press any key to continue . . .
However, when I add a return 0;
at the end of the function, the output is:
Enter a's Value
23
Enter b's Value
62
Sum of numbers is 85
--------------------------------
Process exited after 4.276 seconds with return value 0
Press any key to continue . . .
Why is the return value 20 in the first code, despite me not passing a return value??
7