Skip to content

Instantly share code, notes, and snippets.

@travisperson
Forked from whyrusleeping/for shortcut
Created October 5, 2012 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save travisperson/3842749 to your computer and use it in GitHub Desktop.
Save travisperson/3842749 to your computer and use it in GitHub Desktop.
My favorite Pre-processor hackery
#include <stdio.h>
#define to ; i <=
#define DO(range) for(int range; i++)
int main()
{
int arr[10];
DO(i = 0 to 9)
arr[i] = 2 * i;
DO(i = 0 to 9)
printf("%d\n", arr[i]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment