摘要:
类和对象 成员函数类内实现 #include <iostream> #include<string.h> using namespace std; class Person { private: char mName[32]; int mAge; public: void personInit(ch 阅读全文
摘要:
动态空间申请 new和delete操作基本类型空间 new申请堆区空间, delete释放空间 int *p = NULL; p = new int; //从堆区申请int类型大小的空间 *p = 100; cout << "*p = " << *p << endl; //释放空间 delete p 阅读全文
摘要:
指针数组 数值指针数组 本质的数组, 只是每个元素都是指针 32位平台: char *arr1[4]; short *arr2[4]; int *arr3[4]; sizeof(arr1); //16B sizeof(arr2); //16B sizeof(arr3); //16B 字符指针数组 c 阅读全文
摘要:
数组指针 int arr[5] = {10, 20, 30, 40, 50}; int (*p)[5] = &arr; //数组指针 阅读全文
摘要:
c++对c的扩展 ::作用域运算符 ::使用全局变量 using namespace std; int a = 10; void test01() { int a = 20; cout << a << endl; //20 cout << ::a << endl; //10 } 命名空间 names 阅读全文