For loop is not working

for (auto x : arr)
{
cout << x << " ";
}
it gives
x does not a name type error.
in sublime text.
please help.

Let’s avoid an XY problem-type thing: can you post the entirety of your code?

3 Likes