Download presentation
Presentation is loading. Please wait.
1
Multidimensional array
C Multidimensional array
2
Multidimensional array
An array of arrays known as multidimensional array. Two dimensional (2D) arrays An array of array is known as 2D array. The two dimensional (2D) array in C programming is also known as matrix. A matrix can be represented as a table of rows and columns.
3
Two dimensional (2D) arrays
float x[3][4]; Here, x is a two-dimensional (2d) array. The array can hold 12 elements.
4
Accessing Two-Dimensional Array Elements
An element in a two-dimensional array is accessed by using the subscripts, i.e., row index and column index of the array. For example int val = x[2][3];
5
How to initialize a Two-Dimensional Array
There is more than one way to initialize a multidimensional array.
6
How to initialize a Two-Dimensional Array
IF What is output?
7
Example program on Two-Dimensional Array
8
Example program on Two-Dimensional Array
9
Three-Dimensional Array
Similarly, you can declare a three-dimensional (3d) array float y[2][4][3]; Initialization of a three dimensional array in a similar way like a two dimensional array. Initialization of a three dimensional array. You can initialize a three dimensional array in a similar way like a two dimensional array. Here's an example, int test[2][3][4] = { { {3, 4, 2, 3}, {0, -3, 9, 11}, {23, 12, 23, 2} }, { {13, 4, 56, 3}, {5, 9, 3, 5}, {3, 1, 4, 9} } }
10
Three-Dimensional Array
11
Assignments Write a C program for addition of two matrices
Write a C program for multiplication of two matrices Write a C program for transpose of a matrices Write a sample program on 3D arrays. And perform addition of two 3D arrys
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.