summaryrefslogtreecommitdiff
path: root/4p29.cpp
blob: 44a024506d8f757ab5d254a0fde9367e89e32bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

/*
 *
 * 4.29
 *
 *
 */

int main () {

	int x[10];
	int *p = x;
	auto xx = sizeof(x) / sizeof(*x);
	auto pp1 = sizeof(p);
	auto pp2 = sizeof(*p);
	std::cout << xx << std::endl; // int is 32bit on my machine therefore 40 / 4 = 10
	std::cout << pp1 / pp2 << std::endl; // we get the size of a pointer(8) then the size of an int(4) = 2
	return 0;
}