• + 1 comment

    If you will write just auto c the ranged for will only intialize c with copy of a string element in every iteration of for. So the loop will just keep changing c and discarding its value everytime. But with auto &c a reference is created. If x is reference of y then its like two names x and y that denote the same variable y. So now c becomes just another name for our string element.