数组、指针、动态数组
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include <iostream> #include <string> #include <bitset>
using std::cin; using std::cout; using std::endl; using std::string;
int main() { const unsigned size = 3; int ia[size] = { 0,1,2 }; for (size_t ix = 0; ix != size; ++ix) cout << ix << ":" << ia[ix] << endl; for (int *p = ia; p < ia + size; p++) cout << p << ":" << *p << endl; int *pia = new int[10]; int *pia2 = new int[10](); delete[] pia; delete[] pia2; return 0; }
|
还有const、C字符串、二维数组。没啥好记的,用到时再来翻看。