main()
{ int i=5;
printf("%d",++i + i);

} output is 10

------------------------
main()
{ int i=5;
printf("%d",i++ + i);

}output is 12
why it is so? give appropiate reason....

Answer Posted / ashi smita

in first program i is post increment than i=5 and i=5+5=10
than i is increment by 1 and the value of i is 6 but second
program first i is preincrement by 1 and the value of is 6
than sum of i is 12.

Is This Answer Correct ?    3 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what do u mean by Direct access files? then can u explain about Direct Access Files?

1642


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

615


Why do we need volatile in c?

744


What is spaghetti programming?

670


What is the mean of function?

649






What is the use of #include in c?

576


What are the advantages of the functions?

606


What are the types of c language?

557


console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

655


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2413


What are variables and it what way is it different from constants?

786


What is an array in c?

597


What is static and volatile in c?

781


What are pragmas and what are they good for?

577


How many header files are in c?

553