+ 8
What means the "%c" or the "%d" in C language?
21 Antworten
+ 7
They are string format specifiers. Basically, %d is for integers, %f for floats, %c for chars and %s for strings.
printf("I have been learning %c for %d %s.", 'C', 42, "days");
Output: "I have been learning C for 42 days."
+ 7
GeneralZod I didn't say that strings are primitive data types in C. But an array of chars is commonly referred to as a "string", and that's what %s is for
/Btw: https://codeforwin.org/2015/05/list-of-all-format-specifiers-in-c-programming.html => format specifier: %s, supported data type: char*, description: "string".
+ 7
printf("I like %c%s", 'C', " very much!");
%c Character
%s String of characters
To print an individual character, use %c. This causes its matching argument to be output, unmodified, to the screen.
To print a string, use %s.
+ 5
@anna there is no strings in c
+ 5
Format specifiers that tells to compiler in which format you (compiler) have to input and release output format after completing execution
we have several format specifiers
%c represents character
%d represents integer
%f represents float
%lf represents double
%x represents hexa decimal
%s represents string
%p represents pointer
%u represents unsigned value
it is also called as
1. convertion format
2.convertion string
3 convertion specifier
+ 4
Werg Serium I meant String Rather sorry
+ 3
Integer formatting 😎
+ 3
Only char arrays don't forget array isn't a primitives type it just a class
+ 3
@anna I know just wanted to be sure you knew no hard feeling
+ 3
Werg Serium who talk about array being a class ??
+ 3
Werg Serium You should read well before replying anything post
+ 3
Werg Serium my bad
+ 1
Okey thanks a lot for your explanations 🤗
+ 1
GeneralZod an array is not a class, it is data structures. And there is also array of int or floats too.
+ 1
No problem, now i understand your point. That's ok.
0
"Only char arrays don't forget array isn't a primitives type it just a class"
0
It just a class...
0
So if i read bad explain that 😒
0
What is the specifier for double in c