Different compilers may produce different codes, resulting in different results.
The Code is as follows:
#include <stdio.h> j = q =(++j)+(++j)+(++ }
Environment: win7
Compiler: GCC
IDE: vc ++ 6.0/DEV-C ++
Result: q = 22
: Q = (++ j) + (++ mov eax, dword ptr [ebp-] Move J = add eax, add 1 to the Register eax value, eax = 0040103C mov dword ptr [ebp-], eax moves the register value to the variable j, j = 0040103F mov ecx, dword ptr [ebp-] Move J = add ecx, in the register, ecx +, j = mov dword ptr [ebp-], ecx moves the value on the register ecx to J, J = mov edx, dword ptr [ebp-] Move J = 7 to register edx = 0040104B add edx, dword ptr [ebp-] edx value + j at this time j =, edx = + 0040104E mov eax, dword ptr [ebp-] add j = add eax and eax to 1. In this case, register eax = mov dword ptr [ebp-], eax moves the eax value to j = add edx, dword ptr [ebp-] edx value = edx + j = + 0040105A mov dword ptr [ebp-0Ch], move the edx value to j =
Environment: win7
Compiler: GCC
IDE: VC ++ 2008
Running result: 24
q =(++j)+(++j)+(++ 003A1818 add eax, //eax = 6 003A1821 add ecx, ecx = 7 003A182A add edx, edx = 8 003A1839 mov dword ptr [q],eax