Why is so? When you enter "0", then output is good. When enter other than "0", then no output at all. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is so? When you enter "0", then output is good. When enter other than "0", then no output at all.

https://code.sololearn.com/ckdA0GKl6J5b/?ref=app

15th Aug 2019, 7:35 AM
UraL
4 Answers
+ 2
There is no output because the code didn't finish successfully. You have set to print 2 lines, and print another line when value of <n> is non zero. The 3rd printf call was the one that crashed the program, because you use %s format specifier while passing value of <s> pointer which is a char. Hth, cmiiw
15th Aug 2019, 8:00 AM
Ipang
+ 1
Ipang It's clear. but 2 lines should always be displayed
15th Aug 2019, 10:06 AM
UraL
+ 1
That's not the case when the program crashes UraL
15th Aug 2019, 1:28 PM
Ipang
+ 1
Ok
15th Aug 2019, 1:31 PM
UraL