-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14.cpp
33 lines (29 loc) · 979 Bytes
/
14.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
using namespace std;
int main()
{
int marks[] = {23, 45, 78, 12};
/*
cout << "value of marks[0] " << marks[0] << endl;
cout << "value of marks[1] " << marks[1] << endl;
cout << "value of marks[2] " << marks[2] << endl;
cout << "value of marks[3] " << marks[3] << endl;
cout << "address of marks[0] " << &marks[0] << endl;
cout << "address of marks[1] " << &marks[1] << endl;
cout << "address of marks[2] " << &marks[2] << endl;
cout << "address of marks[3] " << &marks[3] << endl;
*/
for (int i = 0; i < 4; i++)
{
cout << "value of marks[" << i << "] is " << marks[i] << endl;
cout << "address of marks[" << i << "] is " << &marks[i] << endl;
}
cout << endl;
int *p = marks;
for (int i = 0; i < 4; i++)
{
cout << "value of marks[" << i << "] is " << *(p + i) << endl;
cout << "address of marks[" << i << "] is " << p + i << endl;
}
return 0;
}