LearnFrenzy
Sign in Take a free test

Pointers · Pointer Basics MCQ · Question 6

What is a NULL pointer in C? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

Which statement about a NULL pointer is true?

  • A It points to address 0, which stores the value 0
  • B It points to no valid object, and dereferencing it is undefined behaviour Correct
  • C It is the same as an uninitialised pointer
  • D It can only be used with char pointers
Correct Answer: Option B

NULL means "points to nothing". You can compare against it (if (p == NULL)), but reading or writing *p through it is undefined behaviour – usually a crash. An uninitialised pointer is different: it holds a random address you cannot test for.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Popular