The index value of the second dimension in the related array question?

Source: Internet
Author: User
Questions about the index value of the second dimension in the array??
Ask a weak and weak question
For example, there are two columns of pictures, there are no three images of the same size, I would like to ask the second picture above the first-dimension index value and the second-dimensional index value is what?

Because the game code to see the following two ends of the code, a little unclear the basics of the array.

The index value of the first dimension of the object in the piece[][] array
private int Indexx;
The index value of the second dimension of the object in the piece[][] array
private int indexy;

Share to:


------Solution--------------------
0 and 1 chant ...

------Solution--------------------
You're not looking at PHP code.
------Solution--------------------
No context, no explanation
------Solution--------------------
Very faint.
1. Do you say the row or the column ah? From what you say "up and down" feeling is said to be OK, but the coordinates behind it are like columns of vertical rows
2. Subscript general habit starting from 0, that is (this is the serial number, and the following coordinates are different, distinguish)
(0,0) (0,1) ...
(1,0) (...)
The above is a one-dimensional row, two-dimensional is a column, if the one-dimensional is a column, two-dimensional is a row, then the position map becomes
(0,0) (1,0) ...
(0,1) (...)
A few people like to start from 1, to see the program

If the upper-left corner is [0,0] coordinates, then you say [5,10] is (2,1) the position of the upper left corner, [0,15] in the position of (3,0)-here is the first post-column position representation
------Solution--------------------
When organized by [Y][x]
[0] [0] [0][1][0] [2]
[1] [0] [1][1] [about]

When organized by [X][y]
[0] [0] [1][0][2] [0]
[1] [0] [1][1] [2][1]

As you can see, the origin is placed in the upper-left corner of the array. Therefore, the image should also be placed in the upper left corner, so that analysis, calculation is convenient
If you place the original point of the picture in the lower-left corner, there is y ' = h-y
That is, the coordinate system has a vertical flip
------Solution--------------------
0 rows, 1 columns.
------Solution--------------------
It's 0 1.
------Solution--------------------

------Solution--------------------
How the data is organized is based on your needs
You can x, y (column, row)
You can also y,x (row, column)
------Solution--------------------
This question hasn't been clarified yet? Thought Lao Xu could make you understand.

Coordinates are fixed x, y

But the array subscript is determined by the person who wrote the program, either M,n or N,m (m for row, N for column)
The minimum value of M or n (that is, the subscript of the first row/column) is the person who writes the program himself, and when he walks, he takes care to start with the minimum value.
------Solution--------------------
According to the coordinates of the mathematical description
X Horizontal axis
Y Vertical Axis
Sit punctuation = (x, y)

This is common sense!
  • 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.