指针的一个简单应用
#include "stdafx.h"
int main(int argc, char* argv[])
{
//string s("hello world");
string s = "hello world";
string *p = &s;
*p = "goodbye";//此時字符串s的值也變化了
string *sp = &s;
sp = p;
*sp = "new another world";//都指向了同一內存地址
cout << s << endl;//s的值為new another world
return 0;
}
轉載于:https://www.cnblogs.com/xingmeng/archive/2012/03/27/2419464.html
總結
- 上一篇: jsonp的简单学习
- 下一篇: LYNC文件传输功能开关