void main() { char ch='ABCD'; switch(ch) { case 'ABCD': printf("HelloABCD"); break; case 'A': printf("HelloA"); break; case 'B': printf("HelloB"); break; case 'C': printf("HelloC"); break; case 'D': printf("HelloD"); break; } }
-
HelloA
-
HelloB
-
HelloABCD
-
HelloD
-
HelloC
-
Compilation Error
D
Correct answer
Explanation
Multi-character constants like 'ABCD' store multiple bytes in an int. The value is implementation-defined, but most compilers store characters in memory order, so 'ABCD' typically evaluates to the last character 'D' (or the integer representing the bytes). The switch matches case 'D', printing HelloD.