The standard makes no guarantee that local variables appear on the stack in the order they are declared. Some systems/implementations do this. Many modern systems randomize variable locations...