0

arrays

how to display all array elements

18th Feb 2024, 5:31 AM
Jamylah Erich Francisco
Jamylah Erich Francisco - avatar
3 Respostas
+ 4
For example: for(int i=0; i<arrSize; i++){ cout << a[i] << ' '; }
18th Feb 2024, 7:32 AM
JaScript
JaScript - avatar
+ 2
It must be done by using a loop. A two-dimensional array requires nested loops.
18th Feb 2024, 6:05 AM
Brian
Brian - avatar
+ 1
So as written before, you have to use a for loop and nested loops if it is a multiple dimensional array. Compared to C, if you just write : cout << array ; You don’t get all elements of the array, but the memory adress and particulary the adress of the first element ( array[0] ).
18th Feb 2024, 11:39 PM
Christophe
Christophe - avatar