Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is the output for this question:
main()
{
int i=1;
printf("%d%d%d",i,i++,++i);
}

Answers were Sorted based on User's Feedback



what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / 123ghouse@gmail.com

3,2,2;

Is This Answer Correct ?    21 Yes 8 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / rama krishna sidhartha

3,2,2 is the correct output. Because the the associativity
of ++ operator is from right to left.

since i=1

++i = 2(since it is a preincrement operator it is
incremented before printing the value)

i++ = 2(since it is a postincrement operator it is
incremented after printing the value)

i = 3

so it is displayed like 3,2,2.

Is This Answer Correct ?    8 Yes 0 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / r.aruna

answer is 3,2,2
because print the value form right to left.
so,the first one ++i means preincrement.
so,incremented one,2
second one is i++ means postincrement .
it doesn't increment store in same location
but next i means 3.because move to next location

Is This Answer Correct ?    3 Yes 0 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / rameesh ka

answer is
3,2,2

Is This Answer Correct ?    2 Yes 0 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / richa

3,2,2

Is This Answer Correct ?    1 Yes 0 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / girish

1,1,3

Is This Answer Correct ?    3 Yes 6 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / sumalatha

Ans is 2 2 2
because in printf assosiativity is from left to right
first pre increments i that becomes 2 next post increment
is done after printf stmt so prints 2 again, then simple
print i i.e 2again
last post increnent which i becomes 3 but that is done
after printf stmt

Is This Answer Correct ?    1 Yes 4 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / sandeep

1,1,2

Is This Answer Correct ?    5 Yes 15 No

what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }..

Answer / sebestiraj

1,2,3

Is This Answer Correct ?    1 Yes 14 No

Post New Answer

More C Interview Questions

How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

0 Answers  


Can u please send me the exam pattern and also Previous papers to javed123go@gmail.com

0 Answers  


What is wrong in this statement? scanf(“%d”,whatnumber);

0 Answers  


What is difference between array and pointer in c?

0 Answers  


What is p in text message?

0 Answers  


program for reversing a selected line word by word when multiple lines are given without using strrev

0 Answers   IBM,


who will call your main function in c under linux?

2 Answers  


What is the difference between variable declaration and variable definition in c?

0 Answers  


what is c programming?

3 Answers   TCS,


write a prgram of swapping with 2 valiables

6 Answers  


5. What kind of sorting is this: SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

2 Answers   Accenture,


What does *p++ do? What does it point to?

0 Answers  


Categories