0

Colon within the condition in a 'for' loop

int x[10] = {1,2,3,4,5,6,7,8,9,10}; for (int y : x){ // What does the colon do? switch (y) { case 1: cout << "A"; case 3: cout << "B"; case 7: cout << "C"; case 8: cout << "D"; } }

27th Jul 2020, 7:33 AM
Solus
Solus - avatar
1 Respuesta
0
AteFish, did you mean 'assign the elements of the array to y' instead?
28th Jul 2020, 12:17 AM
Solus
Solus - avatar