0

Why is it %5s not %s, what does that 5 mean?

28th Nov 2018, 5:18 PM
Sunil Shah
Sunil Shah - avatar
2 Answers
+ 6
Hello, 😊 Can you specifying your question correctly! Use the search bar! https://www.sololearn.com/post/10362/?ref=app Please, read our guidelines: https://www.sololearn.com/discuss/1316935/?ref=app An useful code for any new user here!;) https://code.sololearn.com/WvG0MJq2dQ6y/
28th Nov 2018, 6:15 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
Sunil Shah, I think you're talking of formatted output in C, right? printf("%s", "word"); means that you insert the string (s) at the spot of the %. printf("%5s", "word"); says how wide this entry will be within the string (in letters). Compare: printf("%s", "x"); leads to the output x while printf("%5s", "x") would look like this: x <-- 4 spaces from the left
28th Nov 2018, 7:20 PM
HonFu
HonFu - avatar