变量定义的同时,必然分配内存,但有一些的动态分配的。
例如:int 4字节;char 1字节;float 4字节,double 8字节
以下宫参考:
The memory a program uses is typically divided into four different areas:
C++将程序内存分为4个区:
The code area, where the compiled program sits in memory.
代码区:程序体所在的区域;
The globals area, where global variables are stored.
全局区:存储全局变量;
The heap, where dynamically allocated variables are allocated from.
堆:存储动态分配的变量;
The stack, where parameters and local variables are allocated from.
栈:存储参数和局部变量。
温馨提示:答案为网友推荐,仅供参考