Display Operation of Array

# Display Operation Of Array:

The Display operation of the array is nothing but the display/print the elements of Array on the console or any output stream.

To display the elements of an Array, We need to iterate it and print the elements.

Below is the program to display the elements of Array.

void display(struct Array objArray)
{
    cout << "Elements in Array are: " << endl;

    for(int i = 0; i < objArray.iLength; ++i)
    {
        cout << objArray.A[i] << " " << endl;
    }
}

int main()
{
    Array objArr = {{2, 4, 6, 7, 8}, 5};
    display(objArr);
    return 0;
}

Comments

Popular posts from this blog

Insert an element in a sorted array

Finding the length of a string in c and c++

Transposition Linear Search