Skip to content

Instantly share code, notes, and snippets.

@thallippoli
Created January 30, 2013 06:52
Show Gist options
  • Save thallippoli/4671282 to your computer and use it in GitHub Desktop.
Save thallippoli/4671282 to your computer and use it in GitHub Desktop.
For any enumeration with a non-trivial wrap where you need the current and prev and/or next index in the loop. (by @cmuratori )
for( i = 0, j = n - 1; i < n; j = i++ )
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment