Stack and Heap about memory address question

▼魔方 西西 提交于 2021-01-29 15:59:59

问题


I knew what is stack and heap, but when I did some experiments on this topic, I found something surprising.

int i,j;

std::cout<< &i << "\n";
std::cout<< &j << "\n";

Results:

0x7a893a29e5b8
0x7a893a29e5bc

That means stack is toward to high address, and not to low address which is shown by below graph.

来源:https://stackoverflow.com/questions/61540247/stack-and-heap-about-memory-address-question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!