What should be the output of this program?
void main()
{
int y=5,z=6;
if(y || ++z)
{
printf("\ny=%d",y);
printf("z=%d",z);
}
}
output:
y= ?(guess)
z=?(guess)
void main()
{
int y=5,z=6;
if(y || ++z)
{
printf("\ny=%d",y);
printf("z=%d",z);
}
}
output:
y= ?(guess)
z=?(guess)
If you don't know the answer, do join this site for all latest updates.
and ask for the solution too
infinite loop
Buddy, how can it be a loop when there is no loop in this program????
5 & 6 since the first condition is true it doesn't go to check the second condition and hence the o/p. :)
great buddy!!
Only you replied it correctly!!!
Good!!!
error bcoz there is an extra closing braces...
if one closing braces will be removed then o/p will be
5 nd 6
that was a syntactical error .
Removed now!!
5 and 6 .. as in OR condition if the thing left to OR is true then it doesnt go to check what is in its right.. so it wont go till ++z and print 5 and 6
Absolutely correct!!