COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
pointer_operation.cpp
Go to the documentation of this file.
1
2
#include <iostream>
3
using namespace
std;
4
5
int
main
()
6
{
7
int
a[5];
8
9
for
(
int
i = 0; i < 5; ++i) {
10
a[i] = 2*i;
11
}
12
13
14
int
* p = a, * q = a + 5;
15
16
while
( p != q ) {
17
cout << *p <<
' '
;
18
++p;
19
}
20
cout << endl;
21
22
return
0;
23
}
main
int main()
Definition
pointer_operation.cpp:5
Module8
Sample Code
Pointers
pointer_operation.cpp
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0