| |
GeekInterview.com > Interview Questions > Programming > C
| Print | |
Question: main() { int i, j, *p; i = 25; j = 100; p = &i; // Address of i is assigned to pointer p printf("%f", i/(*p) ); // i is divided by pointer p }
Answer: A) Compile error B) 1.00000 C) Runtime error. D) 0.00000 Explanation: Error because i/(*p) is 25/25 i.e 1 which is int & printed as a float, so abnormal program termination, runs if (float) i/(*p) -----> Type Casting. |
| December 12, 2005 05:08:13 |
#2 |
| NAVNISH JAIN |
Member Since: Visitor Total Comments: N/A |
RE: main(){ int i, j, *p; i = 25; |
| it is compiler dependent. |
| |
Back To Question | |