I have the following for loop that compares some values before being entered:
1 2 3 4 5
for (;(loc > 0) && (theArray[loc-1 ]> nextItem); --loc){
counter++;
// shift theArray[loc-1] to the right
theArray[loc] = theArray[loc-1];
}
How can I keep track of how many times the for statement is hit? I mean, I know I would use a counter to keep track of how many times the loop is entered but what if the condition ((loc > 0) && (theArray[loc-1 ]> nextItem)) fails and I still want to make sure I count the comparison that happened?