for(auto &a :b) 循环的另一种用法

例子

int arr[10];
for(int i=0;i<10;i++)
{
  arr[i]=i;
}
//与上面for循环输出相同
for(auto &a:arr)
{
  std::cout << a;
}
posted @ 2020-02-04 17:02  消灭猕猴桃  阅读(489)  评论(0编辑  收藏  举报