Skip to content

Instantly share code, notes, and snippets.

@whyrusleeping
Created October 5, 2012 19:53
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 whyrusleeping/3841982 to your computer and use it in GitHub Desktop.
Save whyrusleeping/3841982 to your computer and use it in GitHub Desktop.
My favorite Pre-processor hackery
#include <stdio.h>
#define DO(n) for(int i = 0; i < n; i++)
int main()
{
int arr[10];
DO(10)
arr[i] = 2 * i;
DO(10)
printf("%d\n", arr[i]);
return 0;
}
@travisperson
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment