C Programming
C++ Programming

What is a pointer to pointers?

Top Answer
User Avatar
Wiki User
Answered 2012-06-03 23:54:39

A pointer is a variable like any other. As such, it has memory allocated to it. It is similar to an int in that they both store a value in their memory location. However, whereas an int value is interpreted as a whole number, a pointer's value is interpreted as a memory address. The pointer is said to "point to" the memory address it contains. The type of the pointer determines the type of the variable stored at that memory address. the following is a declaration of a pointer to an integer initialised with the value zero:

int * p = new int(0);

A pointer to a pointer is no different to an ordinary pointer, except the memory address it points to is that of another pointer. The following is an example of a pointer that points to the pointer we've just declared.

int ** pp = p;

Pointer-to-pointer variables are typically used whenever you need to pass a pointer by reference. All pointers are passed by value, so the memory address they contain is passed, not the pointer variable itself. To pass the pointer itself, you must pass a pointer to the pointer, which passes the memory address of the pointer. This then makes it possible to change the memory address stored in that pointer.

Pointer-to-pointer variables are also used when declaring dynamic, multi-dimensional arrays. For instance, a 2-dimensional array requires a pointer-to-pointer to reference the array itself. This pointer points to a 1-dimensional array of pointers, each of which points to a 1-dimensional array of the actual variables in the array. Unlike a static multi-dimensional array, where the entire array occupies contiguous memory, a dynamic multi-dimensional array may not reside in contiguous memory.

Pointer-to-pointer can be extended further to accommodate 3-dimensional arrays, and above. A 3D array requires a pointer-to-pointer-to-pointer, which points to a 1-dimensional array of pointer-to-pointer, each of which references a 2D array, as previously outlined.

User Avatar

Your Answer

Related Questions

A pointer is a variable that stores value of address of a variable. Since a pointer itself is a variable, it is allocated a memory location.Pointer to pointer means a pointer which points to the address of a pointer. In other words a pointer to a pointer has the address of the address of a variable.We can have pointers to int, and pointers to char, and pointers to any structures we've defined, and in fact pointers to any type in C, it shouldn't come as too much of a surprise that we can have pointers to other pointers. If we're used to thinking about simple pointers, and to keeping clear in our minds the distinction between the pointer itself and what it points to, we should be able to think about pointers to pointers, too, although we'll now have to distinguish between the pointer, what it points to, and what the pointer that it points to points.

Double pointers are better known as pointer-to-pointer types. You use pointers to store the memory address of an object but when the object is itself a pointer, you need to use a pointer-to-pointer in instead. Pointer-to-pointer types are typically used when passing pointers into functions. Pointers allow you to pass objects to functions by reference but the pointer itself is passed by value. If you want to pass the pointer by reference, you need to pass a pointer-to-pointer.

Pointer to Pointer is a double pointer, denoted by (**). Pointer stores the address of the variable and pointer to pointer stores the address of a pointer variable and syntax can be given as int **ptr2ptr;

Pointer is a variable that is used to store the memory address of another variable. There are differenr types of pointers: NULL pointer THIS pointer VOID pointer NEAR pointer HUGE pointer FAR pointer WILD pointer

A void pointer is a pointer that has no type information attached to it.A null pointer is a pointer that points to "nothing". A null pointer can be of any type (void included, of course).

As the name suggests Pointer is used to point towards something ,here in this case it points to another variable and stored at a memory location. Pointer is a variable that stores address of another variable. Different Types of pointers are: 1)Dangling Pointers 2)NULL Pointers 3)This Pointer 4)Generic Pointer 5)Near Pointer 6)Far Pointer

Java does not have pointers.

Because of pointers and that all arrays are really pointers. A pointer something like *pointer can also be written as pointer[0] and *(pointer + 1) can also be written as pointer[1]

An array of pointers is that for eg if we have array of 10 int pointers ie int *a[10] then each element that which is stored in array are pointed by pointers. here we will have ten pointers. In pointer to an array for eg int(*a)[10] here all the elements that is all the ten elements are pointed by a single pointer.

The pointer indicates the location of variable . and also *p is indicates the value of the corresponding pointer address....... this is basic advantage of pointers...

Pointers come in different breeds. For example: German Short Haired Pointer and English Pointer.

this pointer stores the address of the class instance, to enable pointer access of the members to the member functions of the class.this pointer is not counted for calculating the size of the object.this pointers are not accessible for static member functions.this pointers are not modifiable.

Pointer variables and function pointers are the two primary types, as well as a void pointer (unknown type). Pointer variables can point to any valid type, including primitive types and user-defined types, as well as other pointer variables. Function pointers can point to any function with the same signature as the function pointer itself. Void pointers can point anywhere.

A Null pointer has the value 0. void pointer is a generic pointer introduced by ANSI. Before ANSI, char pointers are used as generic pointer. Generic pointer can hold the address of any data type. Pointers point to a memory address, and data can be stored at that address.

No,Java does not support pointer. A pointer is a variable which can hold the address of another variable or object. there is no any concept for pointer in java which makes java robust.

There is no such thing as an "array to pointer." What you might be asking is "array of pointers." An array of pointers is just that, an array in which the variables are pointers. In C this would be an array of pointer variables that are each 4 bytes in size. It is declared like this: int *pointers[3]; A pointer to an array is a pointer that points to the whole array. For example, in C if you have int numbers[5][10]; int (*pointerToArray)[10] = numbers + 2; pointerToArray points to the third element of numbers, which is itself an array.

C does not have stream pointers.

Java does not have pointers

It is a pointer.You can pass a smart pointer from one thread to another, and the two threads are free to use their smart pointers just as they were native pointers. They can copy them, assign them, and do whatever they want with them, and the smart pointer will not get you into trouble.

pointer is used when we want to retain the change in values between the function calls. Similarly double pointer is used when we want to retain the change in pointers between the function calls. If you want to modify pointers than you need double pointer to retain the change.

Answergenerally we use simple pointer, void pointer,null pointer, structure pointer. Answerzero or more (unlimited).

NO... there is no 10 pointers in the NBA ...

No there are not. The highest point you can get is a three pointer.

Arrays are implemented as pointers in c.

Pointer are variable which stores memory address of another variable. That is the definition of pointers. but if you want to see the proper usage of pointers you must visit some C programming site.