Why is "%s" used in printf function, because I deleted and the output still the same ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is "%s" used in printf function, because I deleted and the output still the same ?

//I think this printf("%s", "Top 10% \n");// is equivalent to printf("Top 10% \n");

28th Jun 2020, 10:28 AM
ุชูˆููŠู‚ ุนุจุฏ ุงู„ุฑุฒุงู‚
ุชูˆููŠู‚ ุนุจุฏ ุงู„ุฑุฒุงู‚ - avatar
2 Answers
+ 2
ุชูˆููŠู‚ ุนุจุฏ ุงู„ุฑุฒุงู‚ %s will print up to '\0'. Try below it will not print 'Tempor' because of \0. printf("%s", " Top 10 \0 Tempor");
28th Jun 2020, 10:34 AM
$ยข๐Žโ‚น๐”ญ!๐จ๐“
$ยข๐Žโ‚น๐”ญ!๐จ๐“ - avatar