Monday, July 10, 2017

C++11: range-for: array

An array can be used with a range. Here is an example:
#include
#include
using namespace std;
int main()
 {
    int myArray[] = {10, 11, 12};
    for (auto i : myArray)  cout << i << " ";
    return 0;
}
// Output: 10 11 12


No comments:

Post a Comment