I would use the "for()" loop simply to check for the desired condition, with a flag to indicate this condition. Then after the loop, have code to perform certain actions based on the status of this flag.
Code:
for i = 0 until i < array_size
if array1[i] - array2[i] >= threshold
increment counter
else
clear counter
if counter >= n
set flag
end for
if flag == 1
// do something
Note that on line 2 in my example, which was borrowed from your example, you should compare with the absolute value of the difference, in case array 2 happen to contain a larger value than array 1.
Also note that if "array_size" is the size of your array, you're overruning the bounds of that array:
Code:
for (int i = 0; i <= array_size; i++ )
Array indices start at zero and go to N-1. The standard way of representing this would be:
Code:
for (int i = 0; i < array_size; i++ )