0

Can we use arrays In all conditionlas? If,do while,switch?

26th Jul 2017, 12:52 PM
Ponraj Hbk
Ponraj Hbk - avatar
3 Answers
+ 8
Arrays are frequently used together with loops for iteration purposes over part of or the entire array. E.g. int array[5]; //codes for (int i : array) { std::cout << i; } // prints all elements inside the array. switch(array[0]) { case 0: //codes case 1: //codes // more cases } // evaluates the first element in the array //etc
26th Jul 2017, 1:52 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Arrays are arrays, don't link them with the loops. Yes, you can use them in cases you mentioned.
26th Jul 2017, 1:07 PM
soman
+ 1
thanks
26th Jul 2017, 1:54 PM
Ponraj Hbk
Ponraj Hbk - avatar