GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  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:05:23 #1
 NAVNISH JAIN   Member Since: Visitor    Total Comments: N/A 

RE: main(){ int i, j, *p; i = 25;
 
it is compiler dependent.
     

 

Back To Question