Pointer Assignment
A pointer can be assigned to another pointer of the same type. Given two pointers:int *p, *p1;
p1 can be assigned to
p:
p = p1;
The result will be that the variable pointed to by p
is going to be the same as the one pointed to by
p1.
Example
#include <iostream>
using namespace std;
int main()
{
int *p, *p1;
int a = 20;
p = &a;
p1 = p;
cout << "*p1 contains the value: " << *p1;
}
Output
*p1 contains the value: 20