I am skipping header files and void main...
Code 1:-
int a = 5 , c ;
c = a++ + ++a + a++;
a = 5;
printf("%d %d",a++ + ++a + a++ , c);
___________________________________________________
Outputs:-
TCC:- (Yes Borlands 3.0 or whatever it is called one for DOS-blue environment)
19 18
19 = how ? 5+7+7 and if yes (definitely compared to GCC output) but why not 18?
18 = 6+6+6 ? (c assignment code equivalent to
a++;
c=a+a+a;
a++;
a++;) right ?
and why 19 18 ? two different values for exactly same code ?
GCC:-
19 19
19 both 5+7+7 ? makes sense..
Now , Code 2:-
int a = 5 , c ;
c = ++a + ++a + ++a;
a = 5;
printf("%d %d",++a + ++a + ++a, c);
_________________________________________________
TCC:-
24 24
24 with same logic 8+8+8(c assignment code equivalent to
a++;
a++;
a++;
c=a+a+a;
) and a = 8 ;
GCC:-
22 22
22 ? how ? by normal logic 6 + 7 + 8 = 21 but output 22 ?
then 6+8+8 and if yes how ?