+ 6

What is the output of this code?

#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; }

21st Jan 2019, 6:36 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
2 Answers
+ 2
Well, since these cases are unreachable, it will skip to the default label and will output SoloLearn
21st Jan 2019, 6:51 PM
Abdifatah Abdillahi
Abdifatah Abdillahi - avatar
+ 4
Error, because int is checked as char
21st Jan 2019, 6:36 PM
Zhenis Otarbay
Zhenis Otarbay - avatar