COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
dereference.cpp
Go to the documentation of this file.
1#include <iostream>
2
3using namespace std;
4
5int main()
6{
7 int x = 10, y;
8 int * ptr = &x;
9
10 y = *ptr;
11 *ptr = 20;
12 cout << x << ' ' << y << endl;
13 cout << *ptr << endl;
14
15 ptr = &y;
16 (*ptr)++;
17 cout << x << ' ' << y << endl;
18 cout << *ptr << endl;
19
20 return 0;
21}
int main()