Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C Quiz – 104 | Question 5

  • Difficulty Level : Basic
  • Last Updated : 28 Jun, 2021

Which of the following statement is correct for switch controlling expression?

(A) Only int can be used in “switch” control expression.
(B) Both int and char can be used in “switch” control expression.
(C) All types i.e. int, char and float can be used in “switch” control expression.
(D) “switch” control expression can be empty as well.


Answer: (B)

Explanation: As per C standard, “The controlling expression of a switch statement shall have integer type.” Since char is prompted to integer in switch control expression, it’s allowed but float isn’t promoted. That’s why B is correct statement.

Quiz of this Question

Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.
My Personal Notes arrow_drop_up
Recommended Articles
Page :