I'm working on some code in C. I'm trying to create a for loop with an if statement inside of it. And I want this if statement to break the for loop.
for(int i = 0; i != n; i++){
if(dashes[i] == '-'){
break;
}
stillPlaying = 2;
}
Basically, i want the program to check the array "dashes" if it finds a dash, it breaks the for loop and continues with the rest of the code. If it doesn't find a dash, the for loop is broken and stillPlaying is set to 2. Is there a way to do this?
Aucun commentaire:
Enregistrer un commentaire