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  >  Tech FAQs  >  OOPS

 Print  |  
Question:  could any one explan me what happens in this program.

main(){
int i=10;
i=(++i)/(i++);
printf("i=%d",i);
}




May 05, 2006 03:18:52 #5
 AS   Member Since: Visitor    Total Comments: N/A 

RE: could any one explan me what happens in this progr...
 

Reason is quiet simple

i=(++i)/(i++); it will  resolve

like 

i=11/10 which give 1 being int

now post increment works and increment new val of i thus giving 2.

Thanks


 

     

 

Back To Question