Quiz Yourself on void Pointers

Test your understanding of the material presented in this chapter.

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.

Question 1 of 60 attempted

Get hands-on with 1200+ tech skills courses.