fork download
  1. #include <cstdio>
  2.  
  3. constexpr char __char__( int x, int i ) {return (( char * )&x)[ i ];}
  4.  
  5. int main()
  6. {
  7. int a=0x61626364;
  8. char b = __char__(a,1); // wyliczane podczas kompilacji!
  9.  
  10. char tab[b];
  11. printf("%c == %i\n", b, sizeof(tab)/sizeof(char));
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
c == 99