Pau*_*nta 5 c printf variadic-functions
在C你有"%c"和"%f"的格式标志printf-和scanf式的功能.这两个功能的使用可变长度参数...,它总是转换floats到doubles和chars到ints.
我的问题是,如果这种转换发生,为什么做独立的标志char和float存在吗?为什么不只使用相同的标志int和double?
Luc*_*ore 10
因为打印出来的方式不同.
printf("%d \n",100); //prints 100
printf("%c \n",100); //prints d - the ascii character represented by 100
Run Code Online (Sandbox Code Playgroud)