[Solved] Why do I get a wrong answer in this C code?


You are invoking some very undefined behavior. The variable a in the function is at an address (probably on the stack) that is normally only accessible to the function. Decrementing that address results in an undefined location. You don’t know what’s there at all, so you have no idea what incrementing it by 8 will do.

solved Why do I get a wrong answer in this C code?