pointers and array[][][]
-
Hi Im a c++ beginner, I was wondering if someone could help me with using pointers and triangular arrays. I would like to know how to define them correctly, accesing them and finally printing them with a for cycle.:doh:thanks! links to faqs and tutorials are also greatly appreciated;)
-
Hi Im a c++ beginner, I was wondering if someone could help me with using pointers and triangular arrays. I would like to know how to define them correctly, accesing them and finally printing them with a for cycle.:doh:thanks! links to faqs and tutorials are also greatly appreciated;)
-
Here is one solution. char ***pArray = new char **[1]; pArray[0] = new char *[1]; pArray[0][0] = new char[32]; ... delete [] pArray[0][0]; delete pArray[0]; delete pArray; Kuphryn
-
ok, now how would i point to a specific direction and print that? lets say^i have a an array[7][20][50]; and i would like to print it by pointers, how would i do that? or if i would like to print all rows position five etc... thanks for your time:laugh:
int *iArray; iArray = new int [7][20][50]; // set values here for (int x = 0; x < 20; x++) { for (int y = 0; y < 50; y++) { // however you want to print... // i.e. cout << iArray[5][x][y] << endl; } }
Hope that's helpful. If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.