array Container in C++

array: It is a standard container for storing a fixed-size sequence of elements. 

Template Parameters: 

Tp – Type of element. Required to be a complete type.

N – Number of elements.

Syntax:

array<Tp,N>

For Example:

array<int,4> arr = {3,5,6,7} => It create an array of size 4.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    array<int4arr = {3567};

    for (int i = 0i < arr.size(); i++)
        cout << arr[i] << " ";

    return 0;
}


No comments:

Post a Comment