Hi, I'm learning C and have been stumbling my way about. Anyhow, I've been wondering if it is poor practice to control a while loop with a flag. I've found it convenient at times. I assume it is probably better to use the condition that causes the flag to change but sometimes I have more than one thing that should cause me to get out of the loop. Also, setting the flags value based on the condition that caused the flag to be set seems like it can come in handy after the loop. Here's a code snippet of an example (sorry if it's not the greatest..)
Is that ok? I'm trying to avoid developing bad habits and often the feedback I get from instructors is a bit lacking. Thanks!
if(left <= n && array[left] < array[i])
if(right <= n && array[right] < array[smaller])
if(smaller != i)
if(left > n)