RicardasSim

str num

Sep 8th, 2020 (edited)
641
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //-std=c99 -Wall -Wextra -Wpedantic -Wshadow
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. #define LIMIT_NUM 32
  7.  
  8. #define STRINGIZER2(x) #x
  9. #define STRINGIZER(x) STRINGIZER2(x)
  10.  
  11. int main()
  12. {
  13.  
  14.     unsigned int var = LIMIT_NUM;
  15.  
  16.     printf ( "%d\n", var );
  17.  
  18.  
  19.     int arr[LIMIT_NUM] = {0};
  20.    
  21.     printf( "%ld\n", sizeof arr / sizeof *arr );
  22.  
  23.  
  24.  
  25.     char *str = "LIMIT: " STRINGIZER(LIMIT_NUM);
  26.  
  27.     printf ("%s\n",  str );
  28.  
  29.  
  30.     return 0;
  31. }
  32.  
  33. /*
  34. output:
  35.  
  36. 32
  37. 32
  38. LIMIT: 32
  39.  
  40. */
  41.  
RAW Paste Data