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

Answer Posted / pedda

i++ and ++i mean the same thing but they have differently
i++ define post increment that means when the function
is completely after that the value is increment
Example:
i=4 find d=i++ + i; d=9 because i++
initially the value is 4 so 4+4=8 after tha the value d is
increment so finally d value is 9
++i define pre increment that means when the function
is starting increment
Example:
i=4 find d=++i +i; d=9 ++i value is increment
starting so ++i value is 5 so d value is 9

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what standard functions are available to manipulate strings?

604


What's a good way to check for "close enough" floating-point equality?

617


Write a program to check whether a number is prime or not using c?

567


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

1922


What is getch?

624






Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

1594


about c language

1595


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

1905


What are the different data types in C?

719


Explain 'bus error'?

548


Is there a way to jump out of a function or functions?

628


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

660


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

1782


Difference between Function to pointer and pointer to function

623


Write a program to print all permutations of a given string.

636