在c11标准下可以执行的特殊格式的for循环语句,区别在于引用类型可以改变原来的值
#include<iostream>
using namespace std;
int main()
{
string s("hello world");
for(auto c:s)
c='t';
cout<<s<<endl;//结果为hello world
for(auto &c:s)
c='t';
cout<<s<<endl; //结果为ttttttttttt