C Programming :: Declarations and Initializations - Discussion
14 / 54
#include<stdio.h>
void main()
{
int i= 5;
if (i == 5)
return 0;
else
printf("i is not five");
printf("over");
}
#include<stdio.h>
void main()
{
int i= 5;
if (i == 5)
return 0;
else
printf("i is not five");
printf("over");
}
Aa syntax error
Ban execution error
Cprinting of overan error message
Dexecution termination, without printing anything
Show Explanation
Clearly we can see that i value is initialised 5 and the condition i==5 is also true. Hence return 0; will be executed and the execution will be terminated without printing anything coz its return 0 and not print 0.
Return statement brings the control of the program out of the loop.
Asked In ::
The return type of main func is void..then how can it return a value..compilation error or syntax error will be correct
Read Full Answer
Report Error
Please Login First Click Here
In the above program value if i is initialized with 5, and in the next line, the 'if' part checks that whether the value of i is equal to 5 or not, here it is equal so the condition is true and the 'if' part gets executed which states "return 0", meaning that the execution will be terminated without printing or displaying anything in the output screen.
Read Full Answer
Report Error
Please Login First Click Here
Clearly we can see that i value is initialised 5 and the condition i==5 is also true. Hence return 0; will be executed and the execution will be terminated without printing anything coz its return 0 and not print 0.
Return statement brings the control of the program out of the loop.
Read Full Answer
Report Error
Please Login First Click Here