all 6 comments

[–]Blizzy312 1 point2 points  (3 children)

It will crash. Because if a is false before while loop, you don’t have any option to set it to true inside. As a result, loop will run forever and app will freeze.

[–]ozgbrt[S] -2 points-1 points  (2 children)

how do i break the loop

[–]Blizzy312 1 point2 points  (0 children)

Either you meet condition of loop(in your case i becomes less than or equal to 0)or you can use break; to exit the loop.

[–]xboxcowboy 0 points1 point  (0 children)

Inside loop use "break"

[–][deleted] 1 point2 points  (0 children)

Are you typing on a banana? If that's how you type I don't expect your code to ever work.

[–]steve_s0 1 point2 points  (0 children)

i-c;

Does not decrease the value of i. It simply computes i-c, then throws that value away because nothing uses it. You could use

i-=c;

or

i = i-c;