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>
3using namespace std;
4
5int 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}
int main()