public class main {
public static void main(String[] args) {
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
System.out.printf("%d %d\n",x,y);
}
//Output : 56,93
#include<stdio.h>
void main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d ",x,y);
}
//Output : 57 94
According to Operator Precedence Rules whatever output I got through Java code is right but when executing the same in 'C' code it incremented the output values by 1. I am using ubuntu 12.04 64-bit Operating System.