Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is (void*)0?

  • A.Representation of NULL pointer
  • B.Representation of void pointer
  • C.Error
  • D.None of above

Answer: A

Correct answer: Representation of NULL pointer

(void*)0 is an integer constant expression of value zero cast to void *, which is precisely the definition of a null pointer constant. The NULL macro is typically defined as exactly this.

It is not merely "a void pointer" - the value matters as much as the type. Note also that the null pointer's internal representation need not be all-zero bits on every machine; what the standard guarantees is that this constant converts to a null pointer of any type.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.