String format specifier in ' C '? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

String format specifier in ' C '?

As we know all the data types have their format specifiers (e.g. int: %d etc.) But string is not a data type, still why it has the format specifier as %s in C?

16th Aug 2017, 9:52 AM
Safinaz Sayed
Safinaz Sayed - avatar
1 Answer
0
for character(char) the format specifier is %c, there is no datatype called string in C.A string simply is an array of characters, ending with a null byte, we have to use array of characters, We will use %s as format specifier when it is string
16th Aug 2017, 10:38 AM
Sai Krish
Sai Krish - avatar