C language basics-auto-increment and auto-increment, C language basics --

Source: Internet
Author: User

C language basics-auto-increment and auto-increment, C language basics --
If there are two such codes: I ++ program 1:

Uint I; I = 5; I ++;

Procedure 2:

Uint I, Temp; I = 5; Temp = I ++;

After I = 6, the overall value of I ++ is 5

In the last sentence of the two programs, the value of I is changed to the value of [I original value] + 1, while I ++ is the value of the original variable I.

In the example of Program 2, I = 6, Temp = 5.

++ I for ++ I, if I ++ in program 1, 2 is changed to I --, in the example of Program 2, I = 6, Temp = 6.
It is the same for -- and ++.


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.