Code 1:
int main(){
int a=1;
int b=2;
cout << "&a: "<<&a << endl;
}
Output 1:
&a: 0x22ff48
Code 2:
int main(){
int a=1;
int b=2;
cout << "&a: "<<&a << endl;
cout << "&b: "<<&b << endl;
}
Output 2:
&a: 0x22ff4c
&b: 0x22ff48
So My Question is why the address of the varibale a
changed when I printed out the address of the varibale b
?