本文链接:http://blog.youkuaiyun.com/ncepuwanghui/article/details/23712735
#include <iostream>
using namespace std;
void func(char* p)
{
p = new char[128];
//*p = "Hello World";//错误写法:invalid conversion from ‘const char*’ to ‘char’
p = "Hello World";//有警告:将一个字符串常量转换为char*时存在风险,应使用常量指针
cout << "&p = " << &p << endl;
cout << "p = " << (void*)p << endl;
cout << "*p = " << *p << endl;
cout << "p = " << p << endl;
}
int main(int argc, char const *argv[])
{
char *ptr = NULL;
//char *ptr = 0;
cout << "-------------------------------------------------" << endl;
cout << "&ptr = " <