Data structure-an example of an array explanation

Source: Internet
Author: User

struct array{   *base;    /* array element Base address, assigned by Initarray *   / int Dim;           /* Array Dimensions *   / int *bounds;       /* array dimension base address, assigned by Initarray *   / int *constants;    /* array image function constant base address, allocated by Initarray */};
For three-dimensional array a[3][2][2]Baseis a pointer to the array element that stores the memory: a[0][0][0], a[0][0][1], a[0][1][0].........dim Dimension, Save:3the memory that bound points to is stored:3 2 2  //this is [3][2][2]the memory that constants points to is stored:4 2 1  //contants[2]=1 contants[1]= 1 x 2 =2 contants[0]= 2 x 2 =4

Constants[] is calculated.
Constants[dim-1]=1;
for (i=dim-2; i>=0; i--)
Constants[i] = bound[i+1] * constants[i+1];

Data structure-an example of an array explanation

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.