#include<stdio.h>
int main()
{
printf("%d",printf("%d %d",2,2) & printf("%d %d",2,2));
}
The output comes like this: 2 2 2 2 3
I cannot figure out why the output is like this. Any ideas?
printf returns the numbers of characters printed, so here is the explanation:
printf("%d",printf("%d %d",2,2) & printf("%d %d",2,2));
\_________/ \_________________/ | \_________________/
| | | |
| prints "2 2" | prints "2 2"
| and returns 3 | and returns 3
| |
| computes 3 & 3
| (which equals 3)
|
prints "3"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With