-1
C中双重描述符是什么?当我使用Linux上双重C描述符
printf("%d",x)
和x
是double
变量,它说一个警告,它%d expects an int argument, while x is double
。
C中双重描述符是什么?当我使用Linux上双重C描述符
printf("%d",x)
和x
是double
变量,它说一个警告,它%d expects an int argument, while x is double
。
printf("%f", x);
当x
是double
变量。
printf有相当多的格式说明符。这里是基本的:
%d print an int argument in decimal
%ld print a long int argument in decimal
%c print a character
%s print a string
%f print a float or double argument
%e same as %f, but use exponential notation
%g use %e or %f, whichever is better
%o print an int argument in octal (base 8)
%x print an int argument in hexadecimal (base 16)
%% print a single %
你不能只读'printf()'的文档吗? – Barmar 2014-10-30 09:39:43