Thursday, January 6, 2011

Predict the output

int main()
{
int x=0;
if(x==printf(""))
printf("selva");
else
printf("Neo");
return 0;
}

7 comments:

is it "SELA"
printf returns no of charecters i.e "0".

ANS:
Selva

Explanation:
Printf returns the INT no that the characters it has successfully printed
in above case it is printing nothing
Printf("");
so it returns 0 not negative because it is a success

which is equal to 0 so x==0 is true.

Answer for sure is Selva ..

only the if part is executed ..

Post a Comment