Pointer array and array pointer

Source: Internet
Author: User

Two-dimensional array: int a [3] [4] = {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 8, 7, 6 }}; pointer array: int * pa [4]; Note: 1. the pointer array is actually an array, but the elements in the array are pointers, in this example, arrays are stored in pa [0], pa [1], pa [2], and pa [3]. 2. assign a value to a two-dimensional array. a single value is required, that is, * pa = a; * (pa + 1) = a [1]; * (pa + 2) = a [2]; * (pa + 3) = a [3]; array pointer: int (* ap) [4]; Note: 1. array pointer is actually a pointer, the Pointer Points to an array. In this example, the pointer points to a one-dimensional array. 2. assign a value to a two-dimensional array. Because int (* ap) [4]; is equivalent to int ap [] [4], you only need ap =.

Related Article

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.