Considerations for multidimensional arrays

Source: Internet
Author: User

1, for multidimensional array understanding, multidimensional array is an array of arrays, array elements or arrays are called two-dimensional arrays.

2, "C++primer fifth" mentioned in order to better understand the multidimensional array, you should read the definition from inside out.

3. When a multidimensional array is initialized, each line is enclosed in curly braces and can be omitted. You can display the initialization of each row for the first element, or you can display only an initial line of elements.

4. Use the subscript operator to access multidimensional array elements, each of which corresponds to a subscript operator.

5. When using the range for statement to process a multidimensional array, you need to declare the outermost control variable as a reference, regardless of whether the value of the control variable is modified, or the compiler automatically infers the type of the control variable as a pointer.

6. A pointer to a multidimensional array name translates to a pointer to the first inner element, which is the first inner-layer array. By referencing it, you can get the address of the first element of an inner-layer array, and the array name of the array is automatically converted to a pointer to the first element of the array.

Considerations for multidimensional arrays

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.