Add volatile line 19

Add the volatile keyword line 19, to prevent the compiler from optimizing the loop variable