Last active
February 26, 2018 10:39
-
-
Save JadenGeller/532a2c393f06795a1c6d to your computer and use it in GitHub Desktop.
C Macro Tuple
This file contains hidden or 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 LEFT_(X, Y) X | |
#define LEFT(T) LEFT_ T | |
#define RIGHT_(X, Y) Y | |
#define RIGHT(T) RIGHT_ T | |
#define SUM(TUPLE) LEFT(TUPLE) + RIGHT(TUPLE) | |
int main(int argc, char *argv[]) { | |
printf("%i\n", SUM((3, 4))); // -> 7 | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment