Skip to content

Instantly share code, notes, and snippets.

@shreezan123
Created March 18, 2017 17:25
Show Gist options
  • Save shreezan123/88b6a1a5b6d6b546aea579d21f6ed748 to your computer and use it in GitHub Desktop.
Save shreezan123/88b6a1a5b6d6b546aea579d21f6ed748 to your computer and use it in GitHub Desktop.
Iterating 2d array in row major order
#include <iostream>
using namespace std;
int main()
{
int array [10000][10000];
//Populating the 2d array
for (int i = 0; i< 10000; i++)
{
for (int j = 0; j< 10000; j++)
{
array[i][j] = i;
}
}
//Printing in row major order
for (int i = 0; i<10000; i++)
{
for (int j = 0; j<10000; j++)
{
cout << array[i][j]<<endl;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment