Pointer to Pointer
#include <stdafx.h>
#include <iostream>
#include <string>
using namespace std;
/* Pointer to pointer */
int main()
{
int i=100;
int *p;
p=&i;
int **q=&p;
cout<< "Address of pointer p: "<< p << endl;
cout<< "Value in pointer p: "<< *p << endl;
cout<< "Address of pointer q: "<< q << endl;
cout<< "Value in pointer q: "<< *q << endl; // Pointer q contains the address of p.
return 0;
}
Output:
Address of pointer p: 0017F9C0
Value in pointer p: 100
Address of pointer q: 0017F9B4
Value in pointer q: 0017F9C0