Created
December 29, 2019 14:55
-
-
Save gsrunion/a825009a9efe6874c0a7726c5a4d45f8 to your computer and use it in GitHub Desktop.
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 "Boolean.h" | |
struct Boolean Boolean = { | |
0, | |
1, | |
}; |
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
#ifndef UNTITLED1_BOOLEAN_H | |
#define UNTITLED1_BOOLEAN_H | |
typedef struct boolean { | |
int value; | |
}; | |
struct Boolean { | |
int true; | |
int false; | |
}; | |
extern struct Boolean Boolean; | |
#endif |
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 typename(x) _Generic((x), /* Get the name of a type */ \ | |
\ | |
char: "unsigned char", \ | |
char: "char", signed char: "signed char", \ | |
short int: "short int", unsigned short int: "unsigned short int", \ | |
int: "int", unsigned int: "unsigned int", \ | |
long int: "long int", unsigned long int: "unsigned long int", \ | |
long long int: "long long int", unsigned long long int: "unsigned long long int", \ | |
float: "float", double: "double", \ | |
long double: "long double", char *: "pointer to char", \ | |
void *: "pointer to void", int *: "pointer to int", \ | |
int main() { | |
char* s = typename(char); | |
printf("Hello, World!\n"); | |
return 0; | |
} |
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 "Boolean.h" | |
struct Boolean Boolean = { | |
0, | |
1, | |
}; | |
#ifndef UNTITLED1_BOOLEAN_H | |
#define UNTITLED1_BOOLEAN_H | |
typedef struct boolean { | |
int value; | |
}; | |
struct Boolean { | |
int true; | |
int false; | |
}; | |
extern struct Boolean Boolean; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment