#include
#include
char line [80]
int main (){
strcpy(line."ball");
printf("%s\n",line);
printf("%72 s\n",line);
printf("% *s\n",36);
}
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 13, 2012, 8:58 AM EDT
If the value to be printed is shorter than this number, the result is padded with blank spaces.
So, on a normal console window which is 80 characters wide, the following line will cause the string, ball, to be printed at the end of the line, preceded by 76 spaces:
printf("%80s\n","ball");
VulpesRank #55 · 29.2K reputationPosted Aug 13, 2012, 1:59 AM EDT
sami sam39 reputationPosted Aug 13, 2012, 6:38 AM EDT