+ 1

What is the meaning of %s in c?

26th Apr 2021, 6:08 AM
Arin Bagul
Arin Bagul - avatar
4 Respuestas
+ 4
It's a format specifier that is used for strings.
26th Apr 2021, 6:47 AM
sarada lakshmi
sarada lakshmi - avatar
+ 1
And also you can use it for characters in place of '%c'...
27th Apr 2021, 9:24 AM
Aryan Raj
Aryan Raj - avatar
+ 1
Arin Bagul %s tells printf that the corresponding argument is to be treated as a string (in C terms, a 0-terminated sequence of char ); the type of the corresponding argument must be char * . %d tells printf that the corresponding argument is to be treated as an integer value; the type of the corresponding argument must be int https://stackoverflow.com/questions/9026980/what-does-s-and-d-mean-in-printf-in-the-c-language#:~:text=%25s%20tells%20printf%20that%20the,corresponding%20argument%20must%20be%20int%20.
27th Apr 2021, 10:01 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
0
It is not just instead of printf("hello") that you should do this printf("%s", "hello"); but you want to combine stuff like this: (Assuming you know %d) Printf("%d %s", 2, "people") prints this: 2 people
22nd Oct 2024, 12:03 AM
Ivan
Ivan - avatar