C Language – Matrices

C Language
C Language


What are two-dimensional arrays?


Two-dimensional arrays are vectors with multiple dimensions, for example a 3-dimensional array can be used for three-dimensional graphics programs.


Today I will explain two-dimensional arrays called MATRICES.


The matrices can be used to represent tables, chess boards (type of chessboard for games) ……


As the carriers you can do all the operations you want.


As for the vectors, here too the counters are used, but we need two counters, because we make a matrix that is a table we need a row counter and one for columns.


Matrix definition that contains integers of size 5×5 for example:


int matrix[5][5];


0,0 0,1 0,2 0,3 0,4
1,0 1,1      


As you can see in the table the numbers on the left indicate the row number, the others in the column (example 1.0 is indicating row 1 and column 0).


We need to understand the concept:


I gave a dimension to the 5×5 matrix but as you see the C language “WE SAY” starts to count from 0.


So since it starts from 0 and arrives at 4 we always have (let’s call them drawers) 5 drawers where you can enter the values.


To insert and display or in other words to manipulate the matrices we need 2 cycles.


C Language


I recommend getting hold of both the carriers and the matrices.


A nice and difficult exercise would be to put random (random) values into our array and then be able to work on our array by putting the values in ascending or descending order.


Stay Tuned!


Salve, sono un ragazzo di 25 anni, iscritto alla facoltà di informatica, appassionato di programmazione e delle nuove news tecnologiche in ambito informatico.

Related Posts

This site uses Akismet to reduce spam. Learn how your comment data is processed.