What is ***p?

Hello

I am a kind of new in C and C++ so I have a simple question.
Lets say we have variable int var;
then
int *pt = &var
int **ppt = &pt

But now I have a code I need to work with, which has something like
type ***name and it is commented than I can access the elements by *(name[i]).

I don't know what is actually means ***name?

Would you please help?

closed account (48bpfSEw)
1
2
3
4
int a = 1;
int *p1 = &a;
int **p2 = &p1;
int ***p3 = &p2;




i think... ^^
Last edited on
Necip is correct.

However, whoever gave you that code is Not Your Friend. Requiring that level of indirection is an abomination.

Hope this helps.
closed account (48T7M4Gy)
1
2
3
4
5
6
7
8
9
10
#include <iostream>

int main()
{
  int a = 333;
  int* p1 = &a;
  int** p2 = &p1;
  int*** p3 = &p2;
  std::cout << a << '\t' << p1 << '\t' << p2 << '\t' << **p2 << '\t' << ***p3 << '\n';
}


333	0x7a6dcbfc84a4	0x7a6dcbfc84a8	333	333


http://stackoverflow.com/questions/10238699/dynamically-allocating-3d-array
Last edited on
Topic archived. No new replies allowed.