Try checking the assembly output for yourself. Going through the assembly generated by a compiler can be quite interesting.
For example, in gcc you can use the -S command line option
With Visual studio, go to project properties->Configuration Properties->C/C++->Output Files and set the 'Assembler output' option.
for instance, for code like:
int a;
int b;
struct c
{
int a;
int b;
};
.
.
.
struct c cs;
a = 1;
b = 2;
cs.a = 3;
cs.b = 4;
My Visual studio 2008 express generated the following asm code:
; 18 : struct c cs;
; 19 : a = 1;
mov DWORD PTR ?a@@3HA, 1 ; a
; 20 : b = 2;
mov DWORD PTR ?b@@3HA, 2 ; b
; 21 : cs.a = 3;
mov DWORD PTR _cs$[ebp], 3
; 22 : cs.b = 4;
mov DWORD PTR _cs$[ebp+4], 4
One obvious difference we can notice is that the addressing mode for variables 'a' and 'b' is different than the one used for the struct variable 'cs'.