LearnFrenzy
Sign in Take a free test

C Const · const MCQ · Question 10

const int *const p – what can change? Answer, explanation & discussion

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

For const int *const p = &x;, which is allowed?

  • A *p = 5;
  • B p = &y;
  • C Reading *p Correct
  • D Both *p = 5 and p = &y
Correct Answer: Option C

The first const protects the int, the second the pointer. Only reading through p is allowed.

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.

Search LearnFrenzy

Esc

Quick links