NOTE: Without the proper context, the usage of *name
and **name
is ambiguous. it may portrait (a). dereference operator (b) multiplication operator
Considering you're talking about a scenario like
char * name;
char **name;
in the code,
name
is a pointer to a char
.
name
is a pointer, to the pointer to a char
.
Please don't get confused with "double-pointer", which is sometimes used to denote pointer to a pointer but actually supposed to mean a pointer to a double data type variable.
A visual below
As above, we can say
char value = `c`;
char *p2 = &value; // &value is 8000, so p2 == 8000, &p2 == 5000
char **p1 = &p2; // &p2 == 5000, p1 == 5000
So, p1
here, is a pointer-to-pointer. Hope this make things clear now.
*name
and**name
are. – Outride5 * name
it's multiplication. But that is a binary (2 arg)operator *
, not the unary (1 arg)operator*
. – Violentint **name
orstd::cout << **name
. – Violent