+ 8

What means the "%c" or the "%d" in C language?

9th Jun 2019, 4:42 AM
Bastien GERMANY
Bastien GERMANY - avatar
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."
9th Jun 2019, 5:33 AM
Anna
Anna - avatar
+ 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".
9th Jun 2019, 5:45 AM
Anna
Anna - avatar
9th Jun 2019, 9:50 AM
MeanMachine
MeanMachine - avatar
+ 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.
9th Jun 2019, 9:57 AM
MeanMachine
MeanMachine - avatar
+ 5
@anna there is no strings in c
9th Jun 2019, 5:39 AM
GeneralZod
GeneralZod - avatar
+ 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
9th Jun 2019, 8:07 PM
sree harsha
sree harsha - avatar
+ 4
Werg Serium I meant String Rather sorry
9th Jun 2019, 5:10 PM
GeneralZod
GeneralZod - avatar
+ 3
Integer formatting 😎
9th Jun 2019, 4:44 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 3
Only char arrays don't forget array isn't a primitives type it just a class
9th Jun 2019, 5:40 AM
GeneralZod
GeneralZod - avatar
+ 3
@anna I know just wanted to be sure you knew no hard feeling
9th Jun 2019, 6:20 AM
GeneralZod
GeneralZod - avatar
+ 3
Werg Serium who talk about array being a class ??
9th Jun 2019, 5:08 PM
GeneralZod
GeneralZod - avatar
+ 3
Werg Serium You should read well before replying anything post
9th Jun 2019, 5:09 PM
GeneralZod
GeneralZod - avatar
+ 3
9th Jun 2019, 5:11 PM
GeneralZod
GeneralZod - avatar
+ 1
Okey thanks a lot for your explanations 🤗
9th Jun 2019, 6:12 AM
Bastien GERMANY
Bastien GERMANY - avatar
+ 1
GeneralZod an array is not a class, it is data structures. And there is also array of int or floats too.
9th Jun 2019, 4:10 PM
Werg Serium
Werg Serium - avatar
+ 1
No problem, now i understand your point. That's ok.
9th Jun 2019, 5:14 PM
Werg Serium
Werg Serium - avatar
0
"Only char arrays don't forget array isn't a primitives type it just a class"
9th Jun 2019, 5:09 PM
Werg Serium
Werg Serium - avatar
0
It just a class...
9th Jun 2019, 5:09 PM
Werg Serium
Werg Serium - avatar
0
So if i read bad explain that 😒
9th Jun 2019, 5:10 PM
Werg Serium
Werg Serium - avatar
0
What is the specifier for double in c
18th Feb 2020, 11:31 AM
Achintya Raj
Achintya Raj - avatar