Skip to content

Instantly share code, notes, and snippets.

@C47D
Created March 7, 2019 20:28
Show Gist options
  • Save C47D/a423a1bb6ce515fe352f9e7efb84b55a to your computer and use it in GitHub Desktop.
Save C47D/a423a1bb6ce515fe352f9e7efb84b55a to your computer and use it in GitHub Desktop.
String concatenation
#include <stdio.h>
void test_1(void);
void test_2(void);
void test_3(void);
#define USE_TEST(x) (test_##x())
int main(void) {
USE_TEST(1);
USE_TEST(3);
USE_TEST(2);
USE_TEST(1);
// Output:
// 1
// 3
// 2
// 1
return 0;
}
void test_1(void)
{
printf("1\r\n");
}
void test_2(void)
{
printf("2\r\n");
}
void test_3(void)
{
printf("3\r\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment