Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++: variable declaration with 3 asterisks

Tags:

c++

pointers

double ***x;

what does it mean to declare declare a variable with three asterisks? Is this a pointer to a pointer to a pointer to a double?

like image 573
Matt Munson Avatar asked Jun 17 '11 00:06

Matt Munson


People also ask

What does 2 asterisks mean in C?

It declares a pointer to a char pointer.

What does * mean before a variable in C?

In computer programming, a dereference operator, also known as an indirection operator, operates on a pointer variable. It returns the location value, or l-value in memory pointed to by the variable's value. In the C programming language, the deference operator is denoted with an asterisk (*).

What does * After a variable mean in C?

Here, * is called dereference operator. This defines a pointer; a variable which stores the address of another variable is called a pointer. Pointers are said to point to the variable whose address they store.

Why do we use * Before variable in C?

They are the pointer denotations. The '*' is a pointer to a variable, and '&' is its memory address. Since the asterisk resembles a gold coin, I read *b as “value of b”.


2 Answers

It is a pointer to a pointer to a pointer to a double.

like image 142
trutheality Avatar answered Oct 14 '22 11:10

trutheality


Indeed it is a pointer to a pointer to a pointer to a double.

Either a big multi-dimensional array, or just many levels of pointer indirection.

like image 42
Dominic Gurto Avatar answered Oct 14 '22 13:10

Dominic Gurto