Hi friends...
void main()
{
float a=2.45;
printf("%d%f",a,a);
}
what would be the output of above mentioned question and why?
plz. help me.
thanx in advance.
|
Go4Expert Founder
|
![]() |
| 12Aug2008,14:37 | #2 |
|
Try running and see what it gets?
|
|
Newbie Member
|
|
| 12Aug2008,16:04 | #3 |
|
thanx...
It gives unexpected output... let me tell u an example void main() { float a=0.7; printf("%d%f",a,a); } output :--------- 0 and 0.0000000 |
|
Light Poster
|
|
| 13Aug2008,00:44 | #4 |
|
what about this
printf(%d%f,(int) a,a); |
|
Go4Expert Founder
|
![]() |
| 13Aug2008,09:37 | #5 |
|
Change your declaration to
float a = 0.7f; and see whats the output. |
|
Skilled contributor
|
|
| 13Aug2008,13:47 | #6 |
|
nothing is heppened.
it b/c float takes the 4bytes in stact memory of type floating point, but if our program give him a integer value than it's will converted into 0 or 0.00000000, |

