+ 1

How can it's answer be case 3?

switch(printf("hi-")){ case 1: printf("a"); break; case 2: printf("b"); break; case 3: printf("c"); break; default: printf("default");

10th Nov 2019, 2:14 PM
Manthan Gohel
Manthan Gohel - avatar
4 Respuestas
+ 3
Updated: Not exactly, if printf("Some\0Text"); "Some" will be the output and printf() returns 4. So it literally returns the length of "printed" characters. https://code.sololearn.com/ciBBdjlR0R1l/?ref=app
10th Nov 2019, 3:09 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 4
printf() returns the length of printed characters. printf("hi-") returns 3.
10th Nov 2019, 2:36 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
CarrieForle, So in switch statement, printf() function returns the number of charaters enclosed in double quotation?
10th Nov 2019, 2:55 PM
Manthan Gohel
Manthan Gohel - avatar
0
Thanks bro!!! 😊😊😊
10th Nov 2019, 2:59 PM
Manthan Gohel
Manthan Gohel - avatar