Using count++ in a loop

I need to know how many times a loop has run. The loop in this case is reading a sensor every 10 seconds. I am storing the readings in an array. After 2 readings I want to compare them.
The loop is in this if statement "if (currentMillis - previousMillis >= interval)"
How can I use count++ in this loop to know when the program has done 2 readings? Or is there a better way? Thanks.

Post your code... no one can help if we can't see your code.

The simple answer to that is, if count==2, but that said I don't understand what this:

... means, so yeah, what red_car said :wink:

What type of loop ?

Using count++ will allow you to determine how many times a reading has been taken, which is what you want
Do you want to do the comparison just once or continuously ?
Declare count as global, before the loop or static inside the loop if you don't want its value to be reset each time through the loop

Hello
Try this:

++counter%=2;
if (counter==0) doWhatEverYouLike(); 

Have a nice day and enjoy coding in C++.