Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. main()
  2. {
  3. printf("%dn", MARCO);
  4. // printf("%sn", MARCO);
  5. }
  6.  
  7. gcc -D MARCO=12345 test.c
  8.  
  9. gcc -D MARCO=abcde test.c
  10.  
  11. error: ‘abcde’ undeclared (first use in this function)
  12.  
  13. gcc -DMARCO='"abcde"' test.c
  14.  
  15. #include <stdio.h>
  16. #define STRINGIFY(x) #x
  17. #define MACRO(x) STRINGIFY(x)
  18. int main(void)
  19. {
  20. printf("%sn", MACRO(MARCO));
  21. return(0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement