Home > Common Problem > Can rows or columns be omitted in a two-dimensional array?

Can rows or columns be omitted in a two-dimensional array?

烟雨青岚
Release: 2020-07-07 12:00:02
Original
38017 people have browsed it

Two-dimensional arrays can omit rows. Because two-dimensional arrays are stored "rows first, columns second", if you don't specify the number of columns, you can't know how many data can be placed in one row. As long as you know the number of columns, you can know how many rows can be placed in the top row.

Can rows or columns be omitted in a two-dimensional array?

Two-dimensional arrays can omit rows.

Reason:

Because the two-dimensional array is stored in "rows first, columns second", if the number is not specified, he cannot know how many numbers are placed in one row.

As long as you know the number of columns and put them first, you can know how many rows can be placed in total.

When defining a two-dimensional array, after omitting it, the computer must be able to determine the number of rows and columns you define

If you omit the number of rows but determine the number of columns, the computer will determine the number of columns according to your The number of columns and the data you give when initializing automatically determine the number of rows, so the number of rows can be omitted.

But if the number of rows is given but the number of columns is not determined, the computer does not know how to divide the data you initialized. What is the average score? Or divide it in other ways? This is not regulated, and errors may occur.

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of Can rows or columns be omitted in a two-dimensional array?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template