2D Array, Struct, Malloc
2D Array, Struct, Malloc
Shuai Mu
based on slides from Tiger Wang and Jinyang Li
2D Arrray
2D arrays are stored contiguously in memory in row-major format
Multi-dimensional arrays
Declare a k dimensional array int arr[n1][n2][n3]...[nk-1][nk]
ni is the length of the ith dimension
Multi-dimensional arrays
Declare a k dimensional array int arr[n1][n2][n3]...[nk-1][nk]
ni is the length of the ith dimension
Example: 2D array int matrix[2][3]
Multi-dimensional arrays
Declare a k dimensional array int arr[n1][n2][n3]...[nk-1][nk]
ni is the length of the ith dimension
Example: 2D array
int matrix[2][3]
Row 0 Row 1
Col 0
Col 1
Col 2
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- c dynamic data structures
- lecture 08 dynamic memory allocation
- 2d arrays 2d arrays and double pointers bryn mawr
- crash course in c dynamic allocation
- character array i e string example
- short notes on dynamic memory allocation pointer and data
- lecture 05 advanced pointers
- 2d array struct malloc
- practical c c programming part ii
- dynamic memory allocation of 1 d arrays