LearnFrenzy
Sign in Take a free test

Variable Number of Arguments · Variable Arguments MCQ · Question 6

How to read a char passed through ... Answer, explanation & discussion

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

How should a char argument be read with va_arg?

  • A va_arg(ap, char)
  • B va_arg(ap, char *)
  • C (char) va_arg(ap, int) Correct
  • D va_arg(ap, short)
Correct Answer: Option C

char (and short and bool) are promoted to int, so read an int and convert it back if needed.

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