2014-10-30 81 views
-1

C中双重描述符是什么?当我使用Linux上双重C描述符

printf("%d",x) 

xdouble变量,它说一个警告,它%d expects an int argument, while x is double

+2

你不能只读'printf()'的文档吗? – Barmar 2014-10-30 09:39:43

回答

0

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 %