(1) char* ptr="Hello World!";(新标准c++中这样写会有警告:ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] )
(2) char str[]="Hello World!";
"Hello World!"本身都在存储在常量储存区。
但是
(1) char* ptr="Hello World!";(新标准c++中这样写会有警告:ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] )
(2) char str[]="Hello World!";
"Hello World!"本身都在存储在常量储存区。
但是