Can someone please explain how the rows and columns of arrays works? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Can someone please explain how the rows and columns of arrays works?

C++ arrays

16th May 2020, 8:54 AM
Sena Qwame
Sena Qwame - avatar
4 Antworten
+ 1
int arr[3][3] is assigned values j 0 1 2. I, j Index values.... i ------------ 0 [ 1 2 3 ] 1 [ 4 5 6 ] array values... 2 [ 7 8 9 ] 1 2 3 are 0th row values, 4 5 6 are 1st row values.. 7 8 9 are 2nd row values... 1 4 5 are 0th column values.. .... 2 5 8 are 1st column values.. And last, 2 nd column values are 3, 6, 9. Columns are vertical collections in an array denoting there by j variable., while rows are horizontal collections in array denoting by i variable there.. It index values start at 0.
16th May 2020, 12:29 PM
Jayakrishna 🇮🇳
0
Thanks Krishna
16th May 2020, 12:31 PM
Sena Qwame
Sena Qwame - avatar
0
Sena Qwame sry I confused a bit, actually rows are horizontal ones, while columns are vertical ones... I updated all answer to clear representations. Take a look at again.. And you're welcome...
16th May 2020, 12:53 PM
Jayakrishna 🇮🇳
- 1
Thanks bro
16th May 2020, 1:28 PM
Sena Qwame
Sena Qwame - avatar