Skip to content

Instantly share code, notes, and snippets.

@sid24ss
Created November 16, 2014 07:03
Show Gist options
  • Select an option

  • Save sid24ss/5d01f7f4661c49514111 to your computer and use it in GitHub Desktop.

Select an option

Save sid24ss/5d01f7f4661c49514111 to your computer and use it in GitHub Desktop.
triple pointers
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
int*** a;
a = new int**[10];
for (int i = 0; i < 10; i++) {
a[i] = new int*[10];
for (int j =0; j < 10; j++) {
a[i][j] = new int[10];
}
}
for (int i = 0; i < 10; i++)
for (int j =0; j < 10; j++)
for (int k = 0; k < 10; k++)
a[i][j][k] = i*10 + j*10 + k;
for (int i = 0; i < 10; i++) {
for (int j =0; j < 10; j++){
for (int k = 0; k < 10; k++)
cout << a[i][j][k] << "\t";
cout << endl;
}
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment