From 88f0996a4fe125d68b4a7afad5c84b47bdfdec68 Mon Sep 17 00:00:00 2001 From: Papun Charan <42942897+richard937@users.noreply.github.com> Date: Wed, 20 Mar 2019 09:25:09 -0700 Subject: [PATCH] Added 'Pointer to pointer' section (#32819) * Added 'Pointer to pointer' section The 'Pointer to pointer' section describe what is pointer to pointer with an example. * Update index.md Changed Output header to #### --- guide/english/c/pointers/index.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/guide/english/c/pointers/index.md b/guide/english/c/pointers/index.md index 4b5d4547a16..9fd11fbfab7 100644 --- a/guide/english/c/pointers/index.md +++ b/guide/english/c/pointers/index.md @@ -229,7 +229,33 @@ int main(void) return 0; } ``` + +### Pointer to pointer +In case of pointer to pointer the first pointer is used to store the address of the second pointer, and the second pointer is used to point the address of the variable. +```C +#include +int main() +{ + int p=10; + int *p2; + int **p1; //declaration of pointer to pointer + p2=&p; + p1=&p2; + printf("%d\n",p); + printf("%d\n",*p2); + printf("%d",**p1); // printing using pointer to pointer + return 0; +} +``` +#### Output +``` +->10 + 10 + 10 +``` + ### Constant pointer to constant + Above declaration is constant pointer to constant variable which means we cannot change value pointed by pointer as well as we cannot point the pointer to other variable. ```c #include