C - printf                                                                                                           Home : www.sharetechnote.com

 

 

 

 

printf()

 

int d = 123;

float f = 123.45;

 

printf(%d)         ==>123

printf(%8d)        ==>     123

printf(%08d)       ==>00000123

printf(%x)         ==>7b

printf(0x%x)       ==>0x7b

printf(%#x)        ==>0x7b

printf(0x%8x)      ==>0x      7b

printf(%#10x)      ==>      0x7b

printf(0x%08x)     ==>0x0000007b

printf(%#010x)     ==>0x0000007b

printf(%#X)        ==>0X7B

printf(0x%8X)      ==>0x      7B

printf(%#10X)      ==>      0X7B

printf(0X%08X)     ==>0X0000007B

printf(%#010X)     ==>0X0000007B

printf(%f)         ==>123.449997

printf(%8.2f)      ==>  123.45

printf(%08.2f)     ==>00123.45

printf(%8.3f)      ==> 123.450

printf(%08.3f)     ==>0123.450