0

C:nested for problem

I have a question that if I want to nest a "for" in the condition of an "if" what syntax should I obey?(I mean that if I have n inputs and I wanna check the condition of the "if" for each input what should I do?)

26th Oct 2018, 11:15 AM
Matin Zamani
Matin Zamani - avatar
1 Resposta
+ 3
You should probably do it the other way round and nest the if-statement inside of the for-loop, e.g.: for (int i = 0; i < inputs; ++i) { if (condition) { // do whatever } }
26th Oct 2018, 12:06 PM
Shadow
Shadow - avatar