What are the Format Specifiers used with printf?

There are several format specifiers available in printf. The format specifier used varies depending on the data type used for printing. The given below are some of the format specifiers used with printf in C program.



For integer data type the format specifier used with printf is %d or %i

For float data type the format specifier used with printf is %f

For double data type the format specifier used with printf is %lf

For char data type the format specifier used with printf is %c

For string data type the format specifier used with
printf is %s



Apart from this the other format specifiers used with printf are



For displaying a number in scientific notation %e is used with printf.

To get the output in next line the new line character n is used with printf.

To get a % sign in output the used symbol along with printf is %%.



Thus format specifiers are used based on data type and are used to get the output in desired format.

Questions by GeekAdmin   answers by GeekAdmin

Showing Answers 1 - 1 of 1 Answers

sathish

  • Oct 12th, 2006
 

%nxn-may me numericals to specify the alignment of the data it may be +ive or -ive.x-is datatype type .and other formatters lise new line,tab,formfeed,alertetc.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions