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