Created
May 26, 2019 05:59
-
-
Save Silva97/c5896bb15192a836ed451af60bc8344d 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 tostr(...) #__VA_ARGS__ | |
#define type(x) _Generic(x, \ | |
int: "int", \ | |
unsigned int: "unsigned int", \ | |
short int: "short int", \ | |
int *: "int *", \ | |
char: "char", \ | |
char *: "char *", \ | |
unsigned char: "unsigned char" \ | |
) | |
int main(void) | |
{ | |
short int teste_i; | |
printf("Nome: %s\n" | |
"Tipo: %s\n", | |
tostr(teste_i), | |
type(teste_i)); | |
printf("Tudo: %s %s\n", | |
type(teste_i), | |
tostr(teste_i)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment