-3

Can you please tell me why in below code answer is 1610612736? How to calculate this answer?

 #include <stdio.h> int main() { float h=4.1; printf("\n%d\n",h); return 0; } 
2
  • 3
    Turn your warning level up. The compiler should be telling you the problem. Commented Oct 17, 2018 at 20:42
  • warning: format specifies type 'int' but the argument has type 'float' [-Wformat] Commented Oct 18, 2018 at 3:55

1 Answer 1

3

Do this instead:

printf("\n %f", h); 

You need to use the right specifier... you were using %d which is for integers.

Sign up to request clarification or add additional context in comments.

1 Comment

I know that I use of %f, but why for the %d answer is 1610612736?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.