| |
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. |
| August 08, 2008 11:45:42 |
#9 |
| sourabh_t |
Member Since: August 2008 Total Comments: 2 |
RE: 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} |
| C. Runtime Error |
| |
Back To Question | |