LearnFrenzy
Sign in Take a free test

Data Types · Data Types MCQ · Question 6

Integer promotion of char and short in C Answer, explanation & discussion

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

What happens to two short values in a + b?

  • A They are added as shorts and may wrap
  • B Both are promoted to int, and the sum is an int Correct
  • C They are converted to long
  • D The sum is a short
Correct Answer: Option B

Integer promotion converts every type narrower than int to int before arithmetic. So short + short is computed in int and cannot overflow a short – but assigning the result back to a short may truncate it.

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