Using a STL array - C++ STL

C++ examples for STL:array

Description

Using a STL array

Demo Code

#include <array>
#include <cinttypes>
#include <iostream>

int main(int argc, char* argv[])
{
    const int numberOfElements{ 5 };
    std::array<int32_t, numberOfElements> stlArray{ 10, 65, 3000, 2, 49 };

    for (int i = 0; i < numberOfElements; ++i)
    {//from   w  w  w.  j  a v  a2  s . c o m
        std::cout << stlArray[i] << std::endl;
    }

    for (auto&& number : stlArray)
    {
        std::cout << number << std::endl;
    }

    return 0;
}

Result


Related Tutorials