Can i call a function inside the for loop?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can i call a function inside the for loop??

for making graphic program

24th Sep 2017, 5:24 PM
kishan kumar
kishan kumar - avatar
3 Answers
+ 11
Yes. But it is more common to use a while loop for a program that should only exit on user action.
24th Sep 2017, 5:34 PM
Tashi N
Tashi N - avatar
+ 1
well, if a lot has to be done, you can use a function. makes the loop more easy to read. I don't think it had anything to do with exiting our not...
24th Sep 2017, 5:40 PM
ReneDaanen
+ 1
for example void func(int x) { cout<<i; } void main(){ for (int i=0;i<max;i++) { func(i); } }
24th Sep 2017, 5:40 PM
TheExHop
TheExHop - avatar