Last active
February 11, 2023 02:08
-
-
Save ae-s/d5a5ae2842b2ee7fcf3f639f076b21f3 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
/* stupid C puzzle: without trying it in the computer, explain why | |
* does this not work | |
*/ | |
#include <stdio.h> | |
#define NR1 5 | |
#define NR2 4 | |
#define NR3 3 | |
#define NR4 2 | |
#define GETNR(_N) NR##_N | |
int main(int argc, char *argv[]) | |
{ | |
for (int i=0; i<4; i++) { | |
printf("The value of number %d is %d\n", i, GETNR(i)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment