M
mastermind
Hi,
I have some doubts related to indirect width specification.
Here is the sample code:
The output of the above code is 0.00; while if I change the data type of width_f from float to int, then the output comes out to be 20.00. I know thatthe default data type for width specification needs to be 'int'. But I am still not clear about the output when the data type is of float type.
Can anyone help me out with this ?? Thanks in advance.
I have some doubts related to indirect width specification.
Here is the sample code:
Code:
#include<stdio.h>
#include<conio.h>
main()
{
float f=20, width_f=3;
clrscr();
printf("%*.2f",width_f,f);
getch();
}
The output of the above code is 0.00; while if I change the data type of width_f from float to int, then the output comes out to be 20.00. I know thatthe default data type for width specification needs to be 'int'. But I am still not clear about the output when the data type is of float type.
Can anyone help me out with this ?? Thanks in advance.