"); //-->
#include <iostream>
using namespace std;
int global = 100; //全局/静态区
const int N = 10; //常量区
int main()
{
static int a = 0; //全局/静态区
char arr[100]="test";//arr分配在栈上,"test"分配到常量区,还有一个副本在栈上
char *s = "abcde";//s分配在栈上,"abcde"分配在常量区
char*str = NULL; //str分配在栈上
str = new char[10];//str所指向的空间分配在堆上
delete []str;
return 0;
}
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。