0
related to c
Why does this statement. If int a=12,floatb=1.234 printf("%*f",a,b) execute and give 1.2340000
4 Antworten
+ 2
The * you've used tells the printf function to use the "a" (12) for the field width.
Also..just to add...
printf("%*.2f",a,b)....the ".2" (or any number you need) will display 2 decimal places, which can also be specified in a similar method to the field width...e.g
printf("%*.*f" ,a, 2 ,b);
+ 1
"The value is not truncated even if the result is larger."
quoted from here;-
http://www.cplusplus.com/reference/cstdio/printf/
0
If suppose I have given a=0 would it still execute
0
Thanx