print array function c++ code example
Example 1: print array c++
void printArray(int a[],int n){
for(int i=0;i<n;i++)
cout<<a[i]<<" ";
cout<<endl;
}
Example 2: c++ print every element in array
#include<iostream>
int main()
{
int array[8] = {1,2,3,4,5,6,7,8};
int i = 0;
while (i <= sizeof(array)/sizeof(int))
{
std::cout << array[i];
i++;
}
}