'C++ STL array compiler problem on code block

Every time I try running this program my compiler throws an error saying error: no matching function for call to 'begin(int*&). Is it that my compiler is not supporting this standard template. I am using a code block. I even tried installing c++11 ISO C++ language standard [-std=c++11] but it didn't work either.

 array<int,5> arr={1,2,3,4,5};
    for(auto it:arr.begin();it!=arr.end();it++)
    {
        cout<<*it<<" ";
    }
stl


Solution 1:[1]

Replace "auto it:arr.begin()" to "auto it = arr.begin()" and it should work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Harmonieka