Print Array Elements Without Loop C++ Code Example


Example: print the elements of the array without using the [] notation in c++

#include <iostream> using namespace std;  int main() {     int arr[] = {2,4,8};     int size = sizeof(arr) / sizeof(arr[0]);      for (int i = 0; i < size; i++)     {         cout << *(arr + i) << "  "; // prints.. 2  4  8.     } }

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools