/* x 是未知数 */
存在:#include<stdio.h>(标准输入输出函数)
声明: int printf(const char * format,);
printf("",x); ""中可填入 %【flags】【width】【.precision】【modifier】type
(1)type:
1:a 以 0xh.hhp+dd 格式输出 ;(h.hh是16进制,+-dd是10进制)
2:A 同上,将小写字母化为大写字母输出;
3:d,i 整数形式输出;
4:o,u,x 以8,10,16进制输出unsiged整数;
5:e 输出指数
6:f 浮点数
7:g 以指数或者浮点数的格式比较紧凑的格式输出
8:G 同上,将小写字母化为大写字母输出;
9:p 输出地址;(可用于输出指针的地址,或者输出&x的地址)
10:s s输出字符串;
(2)【flags】:
1:- 此标志存在时,表示左对齐;
2:+ 此表示存在时,表示输出符号;
3:0 此标志一般搭配字符个数总长度:例(printf(“%06”,123);表示输 出123,123前面的用0补充)
(3)【modifier】:
1:hh 为了更清楚的描述:例子:printf(“%hhx”,97);(以16进制表示字符a的值) 所以hh后面只跟字符型数据;并且用整数 表达出来字符型数据的ASCLL
用在d,i 输出char signed char
用在o,u,x输出 unsigned char
2:h
用在d,i 输出short int
用在 o,u,x输出 unsigned short int
3:l(L的小写) 用在d,i 输出long int
用在o,u,x输出unsigned long int
4:ll(L的小写)
用在d,i 输出 long long int
用在 o,u,x输出unsigned long long int
5:L 用在a,A,e,E,f,F,g,G 输出long double