I would expect the values of &n
and &n + 1
to be adjacent memory boxes, so their address should differ by 1
. However, every time I run these commands, I get addresses that differ by 4 (for example 0056F800
and 0056F804
). Why does this happen?
#include <iostream>
using namespace std;
int main()
{
int n = 3;
cout << &n << endl;
cout << &n + 1;
}