differences

differences

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

View Answers

January 17, 2011 at 1:04 PM

hi friend,

i++ is post increment where ++i is pre-increment.

For example,

i=5;

i++;//i is 5

now i is 6

++i;//i is 7

now i is 7


January 18, 2011 at 1:21 PM

Hello Friend,

++i will increment the value of i, and then return the incremented value whereas i++ will increment the value of i, but return the pre-incremented value.

Thanks









Related Tutorials/Questions & Answers:
differences
Differences between HashMap and Hashtable?
Differences between HashMap and Hashtable?  Differences between HashMap and Hashtable
Advertisements
Differences between OLAPDataGrid and AdvancedDataGrid
Differences between OLAPDataGrid and AdvancedDataGrid: There are several differences which are following. 1. OLAPDataGrid control does not have a column dragging. 2. OLAPDataGrid control cell has a data which is a result of OLAPQuery
Differences between session and cookie
Differences between session and cookie  What are the differences between session and cookie?   Session is stored in server but cookie stored in client. Session should work regardless of the settings on the client
What are the differences between EJB and Spring
What are the differences between EJB and Spring   Hi, What are the differences between EJB and Spring Thanks
differences - Java Beginners
differences  What are the differences between structured programming and object oriented programming?  Hi Friend, Difference between Structured Programming and Object Oriented Programming: 1) In structured
What are the differences between require and include, include_once?
What are the differences between require and include, include_once?  What are the differences between require and include, include_once
differences between cell spacing and cell padding
differences between cell spacing and cell padding  What are the differences between cell spacing and cell padding
differences between GET and POST methods in form submit
differences between GET and POST methods in form submit  What are the differences between GET and POST methods in form submitting, give the case where we can use GET and we can use POST methods
How to print differences of two text files
How to print differences of two text files  I have the code to compare 2 different text files, however How can I put the difference of 2 text files in other file or print the difrference in the console?? Thanks
differences between require and include, include_once.
differences between require and include, include_once.  What are the differences between require and include, include_once?   Hi friends, Differebne 1: The include_once() function includes and evaluates the specified
For printing out strings, there are echo, print and printf. Explain the differences.
For printing out strings, there are echo, print and printf. Explain the differences.  For printing out strings, there are echo, print and printf. Explain the differences
Differences from HTML 4.01 and XHTML 1.x
Differences from HTML 4.01 and XHTML 1.x   The HTML5 has been updated with adding some advanced features, removing some hindering features and modifying some useful features in a better way. Here are the list of some
What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?
What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?  What are the differences between mysqlfetcharray(), mysqlfetchobject(), mysqlfetchrow
differences - Java Interview Questions
differences - Java Beginners
Differences between the String, StringBuilder, and StringBuffer classes
Differences between the String, StringBuilder, and StringBuffer classes StringBuffer versus String Java provides the StringBuffer and String classes, and the String class is used to manipulate character strings that cannot
Interface Vs Abstract Class
Interface Vs Abstract Class       There are three main differences between an interface and an abstract class: At the same time multiple interfaces can be implemented, but only
Private vs Public Blockchain
Private vs Public Blockchain - Similarities and differences between two types... of malicious attack). Differences between Private and Public Blockchain Now let's.... In this tutorial we have leaned the differences between Private vs Public Blockchain. You
Private vs Public Blockchain
Private vs Public Blockchain - Similarities and differences between two types... of malicious attack). Differences between Private and Public Blockchain... leaned the differences between Private vs Public Blockchain. You can find more
JPA Tutorials
In this section we will examine the differences and similarities between
What is difference between Hibernate 4 and 5?
Hibernate 4 and 5? Here is the differences between Hibernate 4 and Hibernate 5... and ServiceRegistry API updated. In this tutorial we have seen the differences between
What is difference between Hibernate 4 and 5?
Hibernate 4 and 5? Here is the differences between Hibernate 4 and Hibernate 5... and ServiceRegistry API updated. In this tutorial we have seen the differences between
What is difference between Hibernate 4 and 5?
is the differences between Hibernate 4 and Hibernate 5.ADS_TO_REPLACE_4 Change... the differences between Hibernate 5 and Hibernate 4.ADS_TO_REPLACE_7 Explore following
JDBC vs ORM
JDBC vs ORM       In this section we will examine the differences and similarities between JDBC and ORM technologies. Both these technologies are used to save the data
J2EE Tutorial - Java Bean
J2EE Tutorial - Java Bean       To bring out the differences between the different appraoaches,  we will consider a simple case where the user types his
Difference Between ServletConfig And ServletContext
Is Window 8 better than Windows 7?
account of the differences of both the operating systems. The newly launched
php array difference / php array diff
Windows 8 versus Android
of the magnitude of differences at the end user experience is what going to determine... Nexus Q android devices was looking for the state of the art streaming standard
PHP Function Arguments
Java basics
Java basics  Differences between applications and applets
HTML
HTML  What are differences between DIV and SPAN
Java methods
Java methods  What are the differences between == and .equals
SWINGS
SWINGS  WHAT ARE THE DIFFERENCES BETWEEN AWT AND SWINGS
Docker image vs. Docker container
PHP Comments
Java applet
Java applet   How are the differences between Applets and Applications
HTML
HTML   What are the differences between cell spacing and cell padding
JavaBeans - Java Beginners
JavaBeans  List out the differences between SampleBeans and UserDefined JavaBeans with examples
Java collection
Java collection  What are differences between Enumeration, ArrayList, Hashtable and Collections
STRUTS
STRUTS  MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS 2
STRUTS
STRUTS  MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS 2
PHP Addition of Array
What is Sorting in PHP
PHP Array Unique
XML and xlink
XML and xlink  Hi.... please tell me about that What is the differences Between XML and xlink?ADS_TO_REPLACE_1 Thanks
Hibernate - Hibernate
Hibernate  What is the exact difference between HQL query and Criteria and the differences between the two
Java collection
Java collection  What are differences between Enumeration, ArrayList, Hashtable and Collections and Collection
DROP a table and TRUNCATE
DROP a table and TRUNCATE   What are the differences between DROP a table and TRUNCATE a table

Ads