# [C (tcc)], <del>56</del> 54 bytes <!-- language-all: lang-c --> c;f(int*p,int*q){for(c=0;p-q;*p+=++c)c*=!(*p-*++p-c);} [Try it online!][TIO-kxwaeixz] [C (tcc)]: http://savannah.nongnu.org/projects/tinycc [TIO-kxwaeixz]: https://tio.run/##VVDbboMgGL7nKf65bAHBRVfvqHsRZ4wBTEkcUqW7mPHZHbQaLeHj8MN3AJE4IZZF8BZr42LLwnglU9sPWBQpt8mVx5YWlAoi4uIFxzaJKbWJIHxeXrUR3U0qOI9O6v7j8oXQb68l2MHr1J0eHR71n6oddMow8EWQjWvKisCEwLf7xRZHZUT4veCNYeNoKCDlfjoHul9QuvGO3DfJIGIPYV2tOvOTfPVtgsGMUIjw02iDN6VQcGp0tWhGVWZ55U2njMHe0wc@Dzh55E@Y1/j4fRdLKwaHbXbawh2@J8vZbr8eD8rdBuOfjublHw "C (tcc) – Try It Online" * -2 bytes thanks to [pxeger](/users/97857/pxeger) This is a rather straightforward port of my suboptimal [Python answer](https://codegolf.stackexchange.com/a/240429/43394). Takes a pointer to the beginning and end of the array. ## Explanation c; /* int c; (thanks pxeger) */ f( int *p, /* pointer to the first integer */ int *q /* pointer to the last integer */ ) { for ( c=0; /* initialise the increment */ p-q; /* reached the end? (if so, stop) */ /* note: these run out of order */ *p+=++c) c*=!(*p-*++p-c); /* equivalent to: int original_p0 = p[0] - c; // undo increment if (original_p0 != p[1]) { c = 0; // different, so reset counter } p[1] += c; c += 1; p += 1; // move to next p */ }