// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <vector>

using namespace std;

int main()
{
   // 2 D array
   int a1[3][3];
   for(int i=0;i<3;i++) for(int j=0;j<3;j++) a1[i][j]=i*3+j+1;
   int *x1;
   x1 = a1[1];
   for(int i=0;i<3;i++) cout << " " << x1[i];
   cout << endl;
   // array af arrays
   int **a2 = new (int *)[3];
   for(int i=0;i<3;i++) a2[i]=new int[3];
   for(int i=0;i<3;i++) for(int j=0;j<3;j++) a2[i][j]=i*3+j+1;
   int *x2;
   x2 = a2[1];
   for(int i=0;i<3;i++) cout << " " << x2[i];
   cout << endl;
   // vector af vector
   vector< vector<int> > a3;
   vector<int> v[3];
   for(int i=0;i<3;i++)
   {
       for(int j=0;j<3;j++) v[i].push_back(i*3+j+1);
       a3.push_back(v[i]);
   }
   vector<int> x3 = a3[1];
   for(int i=0;i<3;i++) cout << " " << x3[i];
   cout << endl;
   return 0;
}
