-
Notifications
You must be signed in to change notification settings - Fork 0
/
27_Pointer_Part2.cpp
60 lines (41 loc) · 1.01 KB
/
27_Pointer_Part2.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
53
54
55
56
57
58
59
60
#include <iostream>
using namespace std;
void update(int **p){
// p=p+1;// No changes.
// *p=*p+1; Address changed for ptr: YEs changes honge.
**p=**p+1; // Value change : YEs Changes Honge..
}
int main(){
// int i=8;
// int *ptr=&i;
// // ptr=&i;
// int **ptr1=&ptr;
// //Address of i
// cout<<ptr<<endl;
// cout<<&i<<endl;
// cout<<*ptr1<<endl;
// //Address of ptr.
// cout<<ptr1<<endl;
// cout<<&ptr<<endl;
// //Address of ptr1.
// cout<<&ptr1<<endl;
// // Printing value of i.
// cout<<i<<endl;
// cout<<*ptr<<endl;
// cout<<**ptr1<<endl;
// cout<<"before:"<<i<<endl;
// cout<<"before:"<<ptr<<endl;
// cout<<"before:"<<ptr1<<endl;
// update(ptr1);
// cout<<endl;
// cout<<"After:"<<i<<endl;
// cout<<"After:"<<ptr<<endl;
// cout<<"After:"<<ptr1<<endl;
// MCQ's
int first=8;
int second=18;
int *ptr=&second;
*ptr=9;
cout<<first<<" "<<second<<endl;
return 0;
}