+ 1
I don't understand the meaning of this sentence.
Format specifiers begin with a percent sign % and are replaced by corresponding arguments after the format string.
4 Answers
+ 3
åŖäøčŖ²ēļ¼éäøčŖ²åļ¼
https://www.sololearn.com/learn/C/2912/
%d ę“ęø
%f å°ęø
%c char
ä¾å¦ļ¼
printf("%d \n", c);
format string ę "%d \n"
argument ę variable c
printf("%f \n", salary);
format string ę "%f \n"
argument ę variable salary
åØē¬¬äŗčŖ²ļ¼ē¬¬äŗå codeå³äøę¹ļ¼ęé£å TRY IT YOURSELFļ¼é²å
„ code playground, ē¶å¾Runļ¼ēoutputć
- - -
Due to Sololearn Q&A forum rules, please use meaningful question name and relevant tags. For this question, the tag should be "c" and "format-specifier". The question shoud be "Format Specifier in C". Please correct your question, thanks.
+ 3
i.e
int num1 = 1;
int num2 = 2;
printf("%d and %d", num1, num2) ;
%d is a format specifier for integers.
in the above example
first %d will be replaced by num1
second %d will be replaced by num2
output : 1 and 2
if you switch the places of num1 and num2
like :
printf("%d and %d", num2, num1) ;
output : 2 and 1
there are many format specifiers it's what specifies how a value is treated, as a char or int or float...
0
%d,%s,%f like that are position holder's