Search⌘ K
AI Features

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 does not compile because ‘charPtr’ is a ‘void’ pointer, which cannot be directly dereferenced.

B.

'a'

C.

'c'

D.

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


1 / 6
...