0
Does switch work with arrays?
6 Respostas
+ 6
I don't know
+ 2
Then it's not the array type you have to use in switch, but a simple int.
In your idea using array makes no sense. Just assign user's input to int variable and use it.
+ 1
How do you want to use it?
for (x=0; x<sizeof(array); x++){
switch(array[x]){
case 'something':
//who knows
}
}
Like this?
Note: Never used array like this... don't know if it will work. But it should... kinda..
0
I don't think so.
0
I would like to specify an array x, and in switch to parse some values of the array, for example, if the user entered 3, and 3 is in the array, then the case line with 3 would be executed. Many problems, but it's interesting!
0
Oh, I understand. With sleep brain issued this strange idea. Sorry me and thank you for explanation!