COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
dereference.cpp File Reference
#include <iostream>
Include dependency graph for dereference.cpp:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void )

Definition at line 5 of file dereference.cpp.

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}