![]() |
In C++, an array is a fixed-size linear data structure that stores a collection of elements of the same type in contiguous memory locations. In this article, we will learn how to print an array in C++. For Example, Input: Printing Array Elements in C++To print array elements in C++, we can use a simple for loop to iterate over the elements of the array and print each element while iterating. This allows us to print the whole array without using a single statement for printing single element. C++ Program to Print an Array C++The below program demonstrates how we can use a simple for loop to iterate over the array elements and print each one.
Output Array Elements: 10 20 30 40 50 Time Complexity: O(N), where N is the size of the array.
|
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |