summaryrefslogtreecommitdiff
path: root/4p37.cpp
blob: 2b8b16f9d352a01a37a5311595ae1eb011c938b3 (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
#include <iostream>

/*
 *
 * 4.37
 *
 *
 */

int main () {

	char s = 'a'; // just a variable we can use the address for to make the program not segfault
	int i = 0;
	double d = 0;
	const std::string *ps = nullptr;
	char *pc = &s;
	void *pv = &s;
	pv = const_cast<std::string*>(ps);
	i = static_cast<int>(*pc);
	pv = static_cast<void*>(&d);
	pc = static_cast<char*>(pv);
	if(i || d) {} // stop compiler from complaining
	
	return 0;
}