what is the difference between i++ and ++i?

Answer Posted / geetha

i++ and ++i mean the same thing when they form statements
independently,they behave differently.
for example:
i=5;
d=++i;
in this case the value is i,d =6.bcoz first increment and
next assign the value
i=5;
d=i++;
in this case the value of d=5 and i=6.bcoz first assign the
value next increment and it will be change the value i=6.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What type of function is main ()?

589


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

635


What is difference between %d and %i in c?

695


What is signed and unsigned?

646


Where are the auto variables stored?

626






how logic is used

1502


Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.

2652


What is variable declaration and definition in c?

503


What is malloc() function?

638


What is pivot in c?

568


What does != Mean in c?

592


What are terms in math?

594


What is c preprocessor mean?

795


Write a program to use switch statement.

662


What the different types of arrays in c?

614