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
3
using namespace
std;
4
5
int
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
}
main
int main()
Definition
dereference.cpp:5
Module8
Sample Code
Pointers
dereference.cpp
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0