C | Loops & Control Structure | Question 15

In the following program, X represents the Data Type of the variable check.

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
int main()
{
    X check;
    switch (check)
    {
        // Some case labels
    }
    return 0;

chevron_right


Which of the following cannot represent X?
(A) int
(B) char
(C) enum
(D) float


Answer: (D)

Explanation: A switch expression can be int, char and enum. A float variable/expression cannot be used inside switch.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up