summaryrefslogtreecommitdiff
path: root/2p33-2p34.cpp
blob: 334474af2336dbe2f6b08f1d928ed5f1e59bb3d3 (plain)
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
45
46
#include <iostream>

/*
 *
 * 2.33, 2.34
 *
 *
 */

int main () {

	int i = 0, &r = i;
	const int ci = i, &cr = ci;
	
	auto a = r;  // int
	auto b = ci;  // int
	auto c = cr;  // int
	auto d = &i;  // int *
	auto e = &ci;  // const int *
	const auto f = ci;  // const int
	auto &g = ci;  // const int &
	std::cout << a << " " << b << " " << c << " " << d << " "
			  << e << " " << f << " " << g << std::endl;

	a = 42; // valid
	std::cout << a << std::endl;
	
	b = 42; // valid
	std::cout << a << std::endl;
	
	c = 42; // valid
	std::cout << a << std::endl;

	//d = 42; // inValid
	//std::cout << a << std::endl;

	//e = 42; // inValid
	//std::cout << a << std::endl;

	//f = 42; // inValid
	//std::cout << a << std::endl;

	//g = 42; // inValid
	//std::cout << a << std::endl;
	return 0;
}