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

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void )

Definition at line 5 of file pointer_operation.cpp.

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}