(1) B = * p ++;
(2) B = (* p) ++;
(3) B = ++ * p;
(4) B = ++ (* p );
(5) B = * ++ p;
(6) B = * (++ p );
Which of the above six statements are equivalent?
Disassembly code:
[Plain]
B = * p ++;
00411BD9 mov eax, dword ptr [p]
00411BDC mov ecx, dword ptr [eax]
00411BDE mov dword ptr [B], ecx
00411BE1 mov edx, dword ptr [p]
00411BE4 add edx, 4
00411BE7 mov dword ptr [p], edx
B = (* p) ++;
00411BEA mov eax, dword ptr [p]
00411BED mov ecx, dword ptr [eax]
00411BEF mov dword ptr [B], ecx
00411BF2 mov edx, dword ptr [p]
00411BF5 mov eax, dword ptr [edx]
00411BF7 add eax, 1
00411BFA mov ecx, dword ptr [p]
00411BFD mov dword ptr [ecx], eax
B = ++ * p;
00411BFF mov eax, dword ptr [p]
00411C02 mov ecx, dword ptr [eax]
00411C04 add ecx, 1
00411C07 mov edx, dword ptr [p]
00411C0A mov dword ptr [edx], ecx
00411C0C mov eax, dword ptr [p]
00411C0F mov ecx, dword ptr [eax]
00411C11 mov dword ptr [B], ecx
B = ++ (* p );
00411C14 mov eax, dword ptr [p]
00411C17 mov ecx, dword ptr [eax]
00411C19 add ecx, 1
00411C1C mov edx, dword ptr [p]
00411C1F mov dword ptr [edx], ecx
00411C21 mov eax, dword ptr [p]
00411C24 mov ecx, dword ptr [eax]
00411C26 mov dword ptr [B], ecx
B = * ++ p;
00411C29 mov eax, dword ptr [p]
00411C2C add eax, 4
00411C2F mov dword ptr [p], eax
00411C32 mov ecx, dword ptr [p]
00411C35 mov edx, dword ptr [ecx]
00411C37 mov dword ptr [B], edx
B = * (++ p );
00411C3A mov eax, dword ptr [p]
00411C3D add eax, 4
00411C40 mov dword ptr [p], eax
00411C43 mov ecx, dword ptr [p]
00411C46 mov edx, dword ptr [ecx]
00411C48 mov dword ptr [B], edx
Answer: (3) = (4), (5) = (6)