Skip to content

Instantly share code, notes, and snippets.

@ae-s
Last active February 11, 2023 02:08
Show Gist options
  • Save ae-s/d5a5ae2842b2ee7fcf3f639f076b21f3 to your computer and use it in GitHub Desktop.
Save ae-s/d5a5ae2842b2ee7fcf3f639f076b21f3 to your computer and use it in GitHub Desktop.
/* 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