Skip to content

Instantly share code, notes, and snippets.

@certik
Created January 31, 2024 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save certik/888e098241049ee941b0cf5efbe93722 to your computer and use it in GitHub Desktop.
Save certik/888e098241049ee941b0cf5efbe93722 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
#define REPEAT(count, action) REPEAT_HELPER(count, action)
#define REPEAT_HELPER(count, action) \
REPEAT_##count(action)
#define REPEAT_1(action) action(1)
#define REPEAT_2(action) action(2) REPEAT_1(action)
#define REPEAT_3(action) action(3) REPEAT_2(action)
#define PRINT_NUMBER(x) printf("%d\n", x);
REPEAT(3, PRINT_NUMBER)
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment