+ 2

I don't know whats wrong,can anyone help?

/*Taking an input from the user(full name) and printing it's Abbriviated form*/ https://code.sololearn.com/c30F456EUd9i/?ref=app

23rd Feb 2022, 5:15 AM
ANIK
ANIK - avatar
9 Answers
+ 1
On your print statement, instead of %s use %c Line 12
23rd Feb 2022, 5:43 AM
Raul Ramirez
Raul Ramirez - avatar
+ 2
Line 12, d[50] is out of range. Indexing starts from 0, so the max value you can put is 49. But I don't think that is what you want. I assume you want to print the last one as a whole. So, just delete the bracets of variable d https://code.sololearn.com/cU8kcBYk49Nx/?ref=app
23rd Feb 2022, 9:10 PM
Yusuf
Yusuf - avatar
+ 1
format specifiar??where,can you please fix the code and explore whats happening
23rd Feb 2022, 5:42 AM
ANIK
ANIK - avatar
+ 1
Line 12 You still have %s instead of %c plus you have d[50] instead of d[0]
23rd Feb 2022, 5:53 AM
Raul Ramirez
Raul Ramirez - avatar
0
%c
23rd Feb 2022, 5:21 AM
Raul Ramirez
Raul Ramirez - avatar
0
i did actually,still they won't give me any answer i am looking for..can you check running it?
23rd Feb 2022, 5:49 AM
ANIK
ANIK - avatar
0
char ch[50] declars an array of characters %c is to print a single character %s is to print an array of characters
23rd Feb 2022, 5:56 AM
Raul Ramirez
Raul Ramirez - avatar
0
yeah it is,it is the worst i came across for now
23rd Feb 2022, 6:19 AM
ANIK
ANIK - avatar