So learning C by questing everything and understanding behavior of std library functions, I come across this:
In the following 2 codes;
Code1:
#include <stdio.h>
int main()
{
printf(" %d %d",printf("Hello"),printf("Bye"));
return 0;
}
Output:
ByeHello 5 3
Code2:
#include <stdio.h>
int main()
{
printf(" %d",printf("Hello")+printf("Bye"));
return 0;
}
Output:
HelloBye 8
In the first program; the expressions seems to be executed from right to left however in second code the expressions are being executed from left to right. Why would this happen. How are expressions executed exactly?