What do I ++ I mean in the while clause?

Source: Internet
Author: User
What is the meaning of I ++ I in while? what are the meanings of I ++ ii ++ !, This is simple. you can see the following example: int & nbsp; a & nbsp ;=& nbsp; 3; int & nbsp; B & nbsp ;=& nbsp; 0; int & nbsp; I & nbsp ;=& nbsp; 1. what do I ++ I mean?
++ I
I ++
+ I
I +

What do these four Mean? they are always confused!
------ Solution --------------------
This is very simple. you can see the following example:

Int a = 3;
Int B = 0;
Int I = 1;

B = ++ I + a; // first add I to 1, I equals 2, then add it to a, B = 2 + 3 = 5;
B = I ++ a; // The I value remains unchanged. First, it is added with a, B = 1 + 3 = 4; then I is added with 1, and I is equal to 2;


However, in the for statement, both the prefix and the post-fix are similar.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.