Quiz Yourself on void Pointers

Test your understanding of the material presented in this chapter.

We'll cover the following...

Genericity using void pointers

1.

What’s the output of the following code?

char c = 'c';
void* charPtr = &c;

*charPtr  = 'a';
printf("%c\n", *charPtr);
A.

The code doesn’t compile.

B.

'a'

C.

'c'

D.

We can’t say, the code contains undefined behavior.


1 / 6
...