Created
July 21, 2023 00:10
-
-
Save imaami/82b3bfdda736e054dfe59a47f449f04a to your computer and use it in GitHub Desktop.
Cursed sizeof.
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 sizeof(x) (!(#x[0]^0x27)?:sizeof(x)) | |
#define q(x) printf("%-7s\t%zu\n", #x, x) | |
#define p(x) q(sizeof(x)) | |
int main (void) | |
{ | |
char s[7], c; | |
int i; | |
p(s); | |
p(c); | |
p(i); | |
p('x'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment