Created
October 10, 2019 00:15
-
-
Save jrfondren/86980d0b63e993c5bd4821a9f5f6914e to your computer and use it in GitHub Desktop.
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 print(X) _Generic((X), \ | |
double: printf("%f\n", X),\ | |
int: printf("%d\n", X),\ | |
char: printf("%c\n", X)) | |
int main (void) { | |
int x = 42; | |
double z = 11.0; | |
print(x); | |
print(z); | |
print((char)'a'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment