Created
June 20, 2018 20:14
-
-
Save YassineBajdou/97cbe93b99971e0463057d36cce2747c to your computer and use it in GitHub Desktop.
Array 2D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
// Array declaration and initialization | |
int arr[3][5] = {{5, 12, 17, 9, 3}, {13, 4, 8, 14, 1}, {9, 6, 3, 7, 21}}; | |
// Iterate over the array | |
for(int i=0; i<3; i++) | |
{ | |
for(int j=0; j<5; j++) | |
{ | |
// Print out each element | |
cout << arr[i][j]; | |
} | |
// Print new line character after the row is printed in above loop | |
cout << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment