+ 4

Why it is not printing. Can anyone explain me

printf("C programming %s", "Class by\n%sSanfoundry", "WOW"); when i execute this code.. WOW is not printing can someone explain me

29th Aug 2017, 5:11 PM
Manjit Kumar
Manjit Kumar - avatar
12 ответов
+ 11
Why not: printf("C programming %s %s", "Class by\n", "WOW Sanfoundry");
29th Aug 2017, 5:27 PM
Babak
Babak - avatar
+ 10
You are so lovely Manual! You deserve that my friend
29th Aug 2017, 5:38 PM
Babak
Babak - avatar
+ 6
Here is a code I made as an example https://code.sololearn.com/cQV1FbQQIdD8/?ref=app
29th Aug 2017, 5:21 PM
Manual
Manual - avatar
+ 6
I agree with @Babak You already formated the printed value C programming %s with a string the second %s would not refference "wow" not as a string
29th Aug 2017, 5:25 PM
Manual
Manual - avatar
+ 6
Another example inspired by @babak's comment https://code.sololearn.com/c31KP11TnYh3/?ref=app
29th Aug 2017, 5:28 PM
Manual
Manual - avatar
+ 5
Try making a variables for substuting %s
29th Aug 2017, 5:16 PM
Manual
Manual - avatar
+ 5
@Babak @Manjit Thank you!
29th Aug 2017, 5:44 PM
Manual
Manual - avatar
+ 3
@Babak Thank you for the tip! I have not tried that before. 👍
29th Aug 2017, 5:35 PM
Manual
Manual - avatar
+ 3
@Manjit Please press the checkmark next to @Babak's answer. if you see it
29th Aug 2017, 5:36 PM
Manual
Manual - avatar
+ 2
this code snippet is in my mcq question and the answer is printed all except wow.... can u please elaborate
29th Aug 2017, 5:19 PM
Manjit Kumar
Manjit Kumar - avatar
+ 1
yeah now i understood thank u guys
29th Aug 2017, 5:33 PM
Manjit Kumar
Manjit Kumar - avatar
+ 1
me too. hehe
29th Aug 2017, 5:41 PM
Manjit Kumar
Manjit Kumar - avatar