Several forms of arrays defined in C Language

Source: Internet
Author: User

Arrays are often used. They were used in C language and later in C #. Now I will go back and learn C language. I will summarize several forms of arrays defined in C language:

Arrays are often used. They were used in C language and later in C #. Now I will go back and learn C language. I will summarize several forms of arrays defined in C language:

Taking a one-dimensional array as an Example

Int arr [10];

Int arr [] = {1, 2, 4 };

Int arr [10] = {1, 2 };

Int * arr = new int [10];

The first three methods can be used frequently, but you need to pay attention to them when using the fourth method. Compiling in the. c file in this form will fail, but the. cpp file is acceptable. It can be inferred that this is an extension of C ++ to C.

The above conclusions are entirely based on the practices in the Visual Studio environment. Whether tc, bdc, and gcc are established remains to be verified.

 

 

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.