The subtle differences between C and C ++

Source: Internet
Author: User

In C ++, the following restrictions do not exist in C:

 

1. The complete function prototype declaration is required, and the C language is not so strict.

2. In C ++, the name defined by typedef cannot conflict with an existing structure tag, but it is acceptable in C language.

3. When the void * pointer is assigned to another type pointer, C ++ requires forced type conversion, but not in C.

 

Features with different meanings in C ++ and C:

1. At least a dozen keywords are added to C ++.

2. In C ++, statements can appear anywhere in a statement. In C code blocks, all statements must appear before all statements.

3. In C ++, an internal domain structure or variable name hides the structure or variable name of the outer space. This is not true in C.

4. In C ++, the character constant type is Char, but in C language, the character constant type is int.

 

Of course, C ++ has added the object-oriented feature. This is the biggest difference from 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.