0

what is the reason of using %s ???

19th Apr 2020, 6:56 PM
Mahabub Ul Hasib Shawon
4 Respostas
+ 1
To print the string.Basically string is a char array so to print array we have to used arr[] index to access all element we use loop intead of this whole process we can just use %s at the time of printing.
19th Apr 2020, 7:03 PM
VIVEK NIRMALKAR
VIVEK NIRMALKAR - avatar
0
I am still confused. It seems like %s was never needed before this lesson to printf a sentence. The %s doesn't seem to be calling to an array to pull in any stored data that is used for the output. Why is this necessary here? The code in questions is: int score = 89; if (score >= 90) printf("%s", "Top 10%\n"); else if (score >= 80) printf("%s", "Top 20%\n"); else if (score > 75) printf("%s", "You passed.\n"); else printf("%s", "You did not pass.\n");
19th Nov 2020, 9:52 PM
ShaunnaIsHere
ShaunnaIsHere - avatar