-
-
Save whyrusleeping/3843297 to your computer and use it in GitHub Desktop.
My favorite Pre-processor hackery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define to ; i <= | |
#define DO(range) for(int i = range; i++) | |
int main() | |
{ | |
int arr[10]; | |
DO(0 to 9) | |
arr[i] = 2 * i; | |
DO(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
I like it this way better:
https://gist.github.com/3843297