fork download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cstdint>
  4.  
  5. int main() {
  6. const uint32_t whatever = 0xdeadbeef;
  7. uint8_t whatever_bytes[4] = {};
  8.  
  9. std::memcpy(whatever_bytes, &whatever, sizeof(whatever_bytes));
  10.  
  11. // + po to, zeby zmusic std::cout do wyswietlania char jak liczb
  12. std::cout << std::hex << std::showbase
  13. << +whatever_bytes[0] << ' '
  14. << +whatever_bytes[1] << ' '
  15. << +whatever_bytes[2] << ' '
  16. << +whatever_bytes[3] << ' '
  17. << std::endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0xef 0xbe 0xad 0xde