Pointers To Pointers In C language 0 1849

Pointers To Pointers

Pointers store the address of a variable, similarly the address of a pointer can also be stored in some other pointer.

Definition Of Pointer To Pointer

A pointer to a pointer is a form of multiple indirection, or a chain of pointers. Normally, a pointer contains the address of a variable. When we define a pointer to a pointer, the first pointer contains the address of the second pointer, which points to the location that contains the actual value as shown below.

Pointer to Pointer in C

A variable that is a pointer to a pointer must be declared as such. This is done by placing an additional asterisk in front of its name.

Example Of Pointers To Pointers In C Language

main ( )
{
int a=5;
int *p1; /*pointer to an integer*/
int **p2; /*pointer to pointer to an integer*/
int ***p3; /*pointer to pointer to pointer to an integer*/
p1= &a;
p2= &p1;
p3 =&p2;
printf(“%d”,a); /*output = 5*/
printf(“%d”,*p1); /*output = 5*/
printf(“%d”,**p2); /*output = 5*/
printf(“%d”,***p3); /*output = 5*/
printf(“%u”,*p2); /*address of p1 will be printed*/
}

Video Of Pointer To Pointer

Previous ArticleNext Article
Indian Mirchi will serve you taste in Indian news, general knowledge and information. Hope you like the story I write here and expect your points of discussion to improve them and give the best chili test out of the story. I will write tutorials also that helps students. In case you are looking for any specific information then share me in the comment.

Send this to a friend