If C Compiler works from left to right then why is the following code's output in a way as if it is executing from right to left?
int x = 15 ;
printf("%d %d %d", x!=15, x=20, x<30);
Output : 1 20 1
If C Compiler works from left to right then why is the following code's output in a way as if it is executing from right to left?
int x = 15 ;
printf("%d %d %d", x!=15, x=20, x<30);
Output : 1 20 1
First of all, those are expressions and not statements.
Secondly, the order of argument evaluation is unspecified. You can't tell in what order the arguments will be evaluated, and your code would lead to undefined behavior.
For more information about evaluation order and sequencing see e.g. this reference.