Program:
int main( )
{
printf("%d",printf("%d %d",5,5)&printf("%d %d",7,7));
return 0;
}
Output:
5 57 73
I am new to C, I could guess where the 5 57 7 came from, but no idea where the 3 came from. Can someone explain the output?
If you apply binary
ANDto3and3(which are the return values of both nestedprintfcalls) you get3as result.Note that the code actually contains undefined behaviour, since the order of the nested calls isn’t defined.