+ 6
Why is the output here "Sololearn"?
#include <stdio.h> int main() { int i=0; switch(i){ case '0': printf("Solo"); break; case '1':printf("Learn"); break; default:printf("Sololearn"); } return 0; }
3 Respuestas
+ 5
There is no switch option for integer 0 so default switch is used.
+ 1
maybe you didn't notice quotes))
0 is not equal to '0' and is not equal to '1'
+ 1
0 and 1 are characters inside switch. When you compare an integer with character, ASCII value of the character is matched with the character. And ASCII value of character 0 is not equal to 0.