-1

What is the difference between char *val and char ***val. I know what pointers are but can not find anywhere what this triple star notation means.

bluerubez
  • 180
  • 13

2 Answers2

2

Each star you add is another pointer, which means that char *** val is a pointer to another pointer that points to a char pointer

CIsForCookies
  • 10,156
  • 5
  • 36
  • 74
1

The three stars/asterisks mean nothing special. Each of the stars indicate a level of indirection.

Let me exemplify:

char *val is a char pointer called val.

char **val is a pointer to a char pointer called val.

char ***val is a pointer to a pointer to a char pointer called val.

So an asterisk for each pointer level.

Morten Jensen
  • 5,111
  • 3
  • 38
  • 51