2014-10-30 119 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 %