 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you the use of pointer to pointer in C programming. Before starting, you can note my information. You can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tech school. You can download my programming app tech mix, which is available on Google Play. Now here I am going to implement a code in C programming, which will demonstrate you the use of pointer to pointer. So first I am including a header file that is STDI dot H. Now I am defining a main function inside main function. I am declaring a variable A whose value is five. Then I am declaring a pointer and then pointer to pointer. So here P is pointer and double P is pointer to pointer. So P can store address of A because it is a pointer variable. And if you want to store address of a pointer, that is P, then you have to declare pointer to pointer. So in short, pointer to pointer is a variable which can hold address of a pointer variable. So in this code, three variables are declared A, P and double P. A is a normal variable. P is a pointer and double P is a pointer to pointer. So now I can write P equals to address of A. So P is a pointer. That's why it can hold address of A. Second statement is double P equals to address of P. So here pointer to pointer is storing address of P and P is a pointer. So now the situation is value of A is five and address of A is suppose 101. So I have assumed that address of A is 101. It is not exact address. I have just assumed this address. Now when I am assigning address of A into P, so value of P equals to 101. So P is accessing address of A. So address of A is 101. So it will become value of P and then P will be occupying some address in memory. So suppose it is 201. Again, I have assumed this address that is 201. So which is address of P. Now I am assigning address of P into double P. So value of double P equals to 201 which is address of P. So address of P is now value of double P that is pointer to pointer and address of double P may be anything like it is 301. So after these three statements, this hierarchy or this scenario will be available inside memory. Now I want to print five through A through P and through double P. So for that purpose, I am using a single printup statement where I am writing portion D three times and I am using A then asterisk P and then double asterisk double P and then return zero. So now you have to understand how five will be printed through these three notations. So as A is a normal variable, so value of A is five. So this A will print five normally. Now asterisk P. So this asterisk means value at address. So this is a dereferencing operator which provides value that is available at a particular address. So if I remove this asterisk from here, so right now this is P. So value of P is 101. So value of P is 101. Now if I write asterisk P, so asterisk means value at address. So P is containing 101 and now we have to identify its value. So it will become asterisk 101. So here I can say asterisk P equals to asterisk 101. This asterisk P will be equals to asterisk 101 and asterisk means value at address. So value at 101. Now see what is the value of 101 address that is five. So this way asterisk P will be printing five on console. Now double asterisk and double P. So here dereferencing operator is used twice. So asterisk asterisk double P. So we can write it like this asterisk. So double P. So if I remove these two asterisk signs, so double P is you having value 201. So initially it is having 201. So first time double P is representing 201. Now I am placing only one asterisk. So it means value at address. So now we have to find out the value of 201. So at the address 201 value is 101. So if I write only one asterisk, so it means value at 201 that is 101. Now again I have to use dereferencing operator. So this will dereference 101. So now we have to identify value at 101 that is five. So this double asterisk double P will be converted into the notation like this. Asterisk bracket asterisk and then 201. So first 201 will be dereference. So it will provide 101 and then 101 will be dereferenced. So it will provide five. So I hope you have understood how we can identify five through A through asterisk P and through double asterisk double P. So variable pointer and pointer to pointer. All three variables are printing five on console. Now I am going to execute this code. So I am making comment all these statements. Now I am going to execute this code. You can see the output three times five is displayed on console. So here in this small demonstration I have demonstrated you the working of pointer as well as pointer to pointer. So if we want to assign address of a pointer variable then we use pointer to pointer. Now if you want to assign as a pointer to pointer then you can use pointer to pointer to pointer. It means for that purpose you have to declare a variable like this three times asterisk sign and then a variable. So here X is pointer to pointer to pointer which can store address of pointer to pointer and that that will be working similar to pointer to pointer. For dereferencing purpose you have to use three times three times asterisk sign. So you can use this notation. I have assigned address of pointer to pointer into X. Now I can print value through percenty and here I am using the asterisk for dereferencing and then X. Now again five will be displayed. So this time five will be displayed four times. You can see here. So you can use this hierarchy to any depth like pointer then pointer to pointer then pointer to pointer to pointer then pointer to pointer to pointer to pointer and so on. I hope you have understood the working of all these pointers together. If you want to watch more programming related videos you can follow or subscribe my YouTube channel through the URL youtube.com. You can download my programming app Techimace which is available on Google Play. Thank you for watching this video.