forked from YasinEhsan/CPPrograms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pointers.cpp
44 lines (35 loc) · 988 Bytes
/
pointers.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
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
using namespace std;
int main() {
int a[2][2] = {
{123,94},
{37826,584967}
};
int b[2][2] = {
{0,1},
{2,3}
};
cout << "adress of a: " << a << endl;
cout << "adress of a: " << a[0] << endl;
cout << "adress of a: " << &a[0][0] << endl << endl;
cout << "adress of a: " << a + 1 << endl;
cout << "adress of a: " << a[1] << endl;
cout << "adress of a: " << &a[1][0] << endl << endl;
cout << "value of a[0][0]: " << a[0][0] << endl;
cout << "value of a[0][0]: " << **a << endl;
cout << "value of a[0][0]: " << **(a+0) << endl;
cout << "value of a[0][0]: " << *(*a+0) << endl;
cout << *a << endl << endl;
//quiz 2
cout << sizeof(b) << endl;
cout << sizeof(*(b))<< endl;
cout << sizeof(b + 1)<< endl;
cout << b << endl;
cout << *b << endl;
cout << *b + 1 << endl;
cout << &b << endl;
cout << &b + 1 << endl;
cout << *(b + 1) << endl;
cout << b + 1 << endl;
return 0;
}