Main(){ int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("n %d", i);}

A) Some Integer not 100
B) 100
C) Runtime error.
D) None of the above
Explanation: Output = 0

Showing Answers 1 - 11 of 11 Answers

Smita

  • Jan 15th, 2006
 

Compilation error using Turbo C compiler

  Was this answer useful?  Yes

C_learner

  • Jan 18th, 2006
 

You are trying to use a float pointer to point to an integer value....remember typecasting doesn't work well with pointers...even if u give %f in last statement, wouldn't get 100.00 as answer...U will get some undefined behavior....

  Was this answer useful?  Yes

wrongmove

  • Dec 11th, 2008
 

IEEE-754 Floating is used to store Float. So while storing float s store with encoded format. When i is used to access this value it reads 4 bytes which are nothing but IEEE-754 Floating encode. if you type that number in IEEE-754 Floating calculator it will show it as 100.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions