0
Can we use arrays In all conditionlas? If,do while,switch?
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
+ 1
Arrays are arrays, don't link them with the loops. Yes, you can use them in cases you mentioned.
+ 1
thanks