+ 1

How can I print strings

How can I print a string with space in c language. For example. Input: amal 42 Output : amal 42 and not amal42. https://www.sololearn.com/coach/57?ref=app https://code.sololearn.com/c9zTX0slAzDb/?ref=app

20th Oct 2020, 6:03 PM
Amal Gil
Amal Gil - avatar
3 Antworten
+ 2
Hima This is actually a problem solving in sololearn and the case test are incorrect because of it doesn't respect the space. So in the output it should print the spaces.
20th Oct 2020, 6:21 PM
Amal Gil
Amal Gil - avatar
+ 2
Martin Taylor You are correct. I forgot to make it for alphanumeric .
20th Oct 2020, 6:55 PM
Hima
Hima - avatar
+ 1
scanf("%[a-zA-Z ]",str); Use this to input strings with spaces . Here's a guide to scanf https://code.sololearn.com/cqCvRaufP2m4/?ref=app
20th Oct 2020, 6:08 PM
Hima
Hima - avatar