Skip to main content
added 1 character in body
Source Link
Ritesh
  • 1.8k
  • 1
  • 15
  • 18
#include <stdio.h> int funcfunc2(int x) { return x+1; } int func1(int x) { return x+2; } int main() { int x = 0; int y = HASH(x); printf("x=%d\n", y); return 0; } 

I wrote the above code and I compiled with : gcc -O0 -DHASH=func1 -o test test.c and gcc -O0 -DHASH=func2 -o test test.c

And I got output 1 and 2. I think the important thing to notice is that I have not #defined HASH anywhere in the code.

#include <stdio.h> int func(int x) { return x+1; } int func1(int x) { return x+2; } int main() { int x = 0; int y = HASH(x); printf("x=%d\n", y); return 0; } 

I wrote the above code and I compiled with : gcc -O0 -DHASH=func1 -o test test.c and gcc -O0 -DHASH=func2 -o test test.c

And I got output 1 and 2. I think the important thing to notice is that I have not #defined HASH anywhere in the code.

#include <stdio.h> int func2(int x) { return x+1; } int func1(int x) { return x+2; } int main() { int x = 0; int y = HASH(x); printf("x=%d\n", y); return 0; } 

I wrote the above code and I compiled with : gcc -O0 -DHASH=func1 -o test test.c and gcc -O0 -DHASH=func2 -o test test.c

And I got output 1 and 2. I think the important thing to notice is that I have not #defined HASH anywhere in the code.

Source Link
Ritesh
  • 1.8k
  • 1
  • 15
  • 18

#include <stdio.h> int func(int x) { return x+1; } int func1(int x) { return x+2; } int main() { int x = 0; int y = HASH(x); printf("x=%d\n", y); return 0; } 

I wrote the above code and I compiled with : gcc -O0 -DHASH=func1 -o test test.c and gcc -O0 -DHASH=func2 -o test test.c

And I got output 1 and 2. I think the important thing to notice is that I have not #defined HASH anywhere in the code.