The stack layout

I try to solve the problem http://www.unix.com/showthread.php?p=86595 use stack hack method, I am puzzled the stack layout.
under vc6.0, the following code work(in release mode).
#include <stdio.h>

void change()
{
int x;
int j;
(&x)[3] = 5; // if in debug mode, change to (&x)[22] = 5;
}

int main()
{
int i = 10;
change();
printf("%d\n", i);
}

But in my FreeBSD box, whatever address I change, the i never change, except core dump when I run program.
:confused: Can any expert explain how the stack layout in system, for example, how does BSD system layout the stack and how does the Windows layout the stack?
Any response is appreciated.

Hi ching,

I am also very much interested in knowing how is the memory layout for C.

Check this one out. It may be useful ..

Regards,
Parasa Kiran