摘要:
int *p = new int; cout <<"p` address :" << p << endl; *p = 123; delete p; // int *p2 = 123; int *p1 = {1, 2, 3, 4, 6}; //以上形式是错误的,计算机只会分配指针占用的内存,但是不会初始化 右边数据的内存 //... 阅读全文
摘要:
string str = "sdfsdfsd1234fsdf"; cout << str.size() << endl; cout << str.insert(str.size(), "123") << endl; cout << str.find("123") << endl; cout << str.substr(0, 4) << endl; cou... 阅读全文
摘要:
char str[] = "123"; // strlen 只计算可见字符, sizeof 则包含'\0' 在内 cout << "strlen : " << strlen(str) << endl; cout << "sizeof :" << sizeof(str) << endl; char name[10]; char name1[10]; ... 阅读全文