+ 2
Please explain the concepts of arrays (multidimensional and jagged arrays)
4 Réponses
+ 3
Regardless of languages, i think you’re asking “What is a matrix?”
matrix = [
0 0 0
0 0 0
0 0 0
]
Written in most programs as:
matrix = [[0,0,0],[0,0,0],[0,0,0]]
Matrices are complicated structures with their own behaviours in mathematics. Multiplying two matrices is not the same as multiplying two integers.
This article gives a nice explanation of some of the concepts of manipulating mattices:
http://polymathprogrammer.com/2008/08/11/matrices-for-programmers/
After you read that, i suggest looking up whatever language youre coding in. Matrices in python are handled differently than in C++ but the fundamental concepts are the same.
+ 2
Basically, arrays within arrays. This means that within your array, you can group your elements.
+ 2
arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
// Representation of 2D array
1 2 3
4 5 6
7 8 9
arr[3][ ] = {{1,2,3},{4,5},{6,7,8,9}};
// Representation of jagged array
1 2 3
4 5
6 7 8 9
Almost every row in a jagged array has different number of columns.
+ 1
Please add C# in the thread tags (your current selection for language course) 👍