| |

VerySource

 Forgot password?
 Register
Search
View: 739|Reply: 5

Beginner question of an array!

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-17 15:30:01
| Show all posts |Read mode
One book wrote like this: "For example, the type int [] [,,] [,] is a single-dimensional array type, the element type is a three-dimensional array type, and the element type of the three-dimensional array type is a two-dimensional array type. The element type of the dimension array type is int. "This sentence is really incomprehensible. Can any friend take the time to explain it?
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-4-21 22:15:01
| Show all posts
All are one-dimensional arrays. For example, a table is two-dimensional, then put these tables in a stack, it is three-dimensional. The physical model of more than four dimensions is not easy to think
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-4-22 07:45:01
| Show all posts
Staggered array, give you an example, you should be clear ...

int [] [,] jaggedArray4 = new int [3] [,]
{
    new int [,] {{1,3}, {5,7}},
    new int [,] {{0,2}, {4,6}, {8,10}},
    new int [,] {{11,22}, {99,88}, {0,9}}
};
Reply

Use magic Report

0

Threads

38

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-22 20:15:01
| Show all posts
Array of elements ~
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-23 20:30:01
| Show all posts
kalian2000:
Staggered array, give you an example, you should be clear ...

int [] [,] jaggedArray4 = new int [3] [,]
{
    new int [,] {{1,3}, {5,7}},
    new int [,] {{0,2}, {4,6}, {8,10}},
    new int [,] {{11,22}, {99,88}, {0,9}}
};

Thank you for your explanation! I fully understand yours, that is, three 2D variable-length arrays are defined and initialized. But I still can't understand my question! Maybe I'm stupid.
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-4-24 22:15:01
| Show all posts
TO:
The type int [] [,,] [,] is a single-dimensional array type, the element type is a three-dimensional array type, the element type of the three-dimensional array type is a two-dimensional array type, and the element type of the two-dimensional array type is an int type

int [,] is a two-dimensional array, and the elements are of type int, no problem ..

int [,,] [,] is a three-dimensional array, but its elements are two-dimensional arrays. Separately, each element in int [,,] is a two-dimensional array (int [,])

The type int [] [,,] [,] is a one-dimensional array, but the elements are three-dimensional arrays int [,,] [,]

I don't know if you can understand this explanation?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list