C # to c++--c# transformation C + + road (i) C

Source: Internet
Author: User

It takes a lot of determination to do a full-time study. Some people will say, why not work while learning. Indeed, everyone has their own way, I choose to go to the bottom of the technology, rapid. So, after a long period of consideration, I still choose to study full-time.


Now that you learn C/C + +, you should learn.

Constant:

C's constant is different from C #, and of course, the syntax of C # is Microsoft encapsulated. The constants of C are defined by # define, which is the macro in C. Its essence is the compiler pre-compilation phase for text substitution. Replace the macro defined by # define with the location where the macro is used.

and const is the keyword in C # that defines constants. However, in C, Const defines a read-only variable and must be assigned when defined, otherwise it cannot be assigned.


+ + with--:

Self-increment and self-reduction.

int I=10;int a=i++ + i;i=10;int b= ++i + i;

The above code is a=21,b=22 in C #, because i++ takes effect the next time the variable is used in C #.


In C, this code a=20 b=22

The difference between this and C # is that i++ is a self-increment after the execution of the expression is complete.

That is, i++ + i in C i++ equals 10, because the expression has not been executed, so the value of I is still 10. So i++ + i is actually 10



Long

In C, the long type, under the 32-bit operating system, is also 4 bytes with the int type. In most 64-bit operating systems, it is 8 bytes. But a long long is 8 bytes.


C # to c++--c# transformation C + + road (i) C

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.