// Constante pointers

int main() {
	const int* p(&i);
	// p wijst naar i en je kan i niet via p wijzigen. Let op: je kan i zelf
	// wel wijzigen!
	i=4;
	// Goed
	*p=5;
	// Fout (Borland):   Cannot modify a const object
	// Fout (Microsoft): 'p' : you cannot assign to a variable that is const
	// Fout (gcc):       assignment of read-only location
	p=&j;
	// Goed

	int* const q(&i);
	// q wijst naar i en je kan q nergens anders meer naar laten wijzen. Let
	// op: je kan i wel via q (of rechtstreeks) wijzigen.
	i=4;
	// Goed
	*q=5;
	// Goed
	q=&j;
	// Fout (Borland):   Cannot modify a const object
	// Fout (Microsoft): '=' : cannot convert from 'const int *' to 'int *const ' (Conversion loses qualifiers)
	// Fout (gcc):       assignment of read-only variable `q' (invalid conversion from `const int*' to `int*')

	const int* const r(&i);
	// r wijst naar i en je kan i niet via r wijzigen en je kan r nergens
	// anders meer naar laten wijzen. Let op: je kan i zelf wel wijzigen!
	i=4;
	// Goed
	*r=5;
	// Fout (Borland):   Cannot modify a const object
	// Fout (Microsoft): 'r' : you cannot assign to a variable that is const
	// Fout (gcc):       assignment of read-only location
	r=&j;
	// Fout (Borland):   Cannot modify a const object
	// Fout (Microsoft): 'r' : you cannot assign to a variable that is const
	// Fout (gcc):       assignment of read-only variable `r'

	return 0;
}
