Open In App
Related Articles

C Quiz – 104 | Question 5

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
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

Last Updated : 28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Similar Reads