#include#include #include using namespace std;int main(){ //test1 声明时必须指定数组的大小 //test2 初始化 //test3 char数组 //test4 数组拷贝和赋值 //test5 指针数组, 数组的指针, 数组的引用,指针数组的引用 //test6 数组的范围for用法 int ar[5] = {}; for(auto &s : ar){ s = s + 1; } //用size_t作为下标的类型,包括在cstddef头文件里 size_t idx = 1; ar[idx] = 100; for(auto s : ar){ cout << s << ","; } cout << endl; }
原文出处:https://www.cnblogs.com/xiaoshiwang/p/9625464.html



