-
Notifications
You must be signed in to change notification settings - Fork 0
/
lec27_doublepointer.cpp
53 lines (41 loc) · 988 Bytes
/
lec27_doublepointer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//Playing with double pointers
/*
#include <iostream>
using namespace std;
void update(int **p)
{
//p=p+1;
//kuch change hoga ? --NO
//*p=*p+1;
//kuch change hoga ?--YES
//**p=**p+1;
//kuch change hoga ?
}
int main()
{
int i = 5;
int *p = &i;
int **p2 = &p;
cout << endl
<< "Everything is fine." << endl
<< endl;
cout << "Address of p : " << &p << endl;
cout << "Printing i : " << i << endl;
cout << "Printing *p : " << *p << endl;
cout << "Printing **p2 : " << **p2 << endl;
cout << endl;
cout << "Printing p : " << p << endl;
cout << "Printing *p2 : " << *p2 << endl;
cout << endl;
cout << endl;
cout <<"Before "<< i << endl;
cout <<"Before "<< p << endl;
cout <<"Before "<< p2 << endl;
cout << endl;
update(p2);
cout <<"After "<< i << endl;
cout <<"After "<< p << endl;
cout <<"After "<< p2 << endl;
cout << endl;
return 0;
}*/