title: How to access same memory address as two different data types (uint64_t/uint8_t[8]) in C?
body: <p>I would like to access a single memory location with two different datatypes in the C programming language.</p>
  
  <p>This is how I want it to be done:</p>
  
  <p>I make a pointer and allocate 64 bits of memory for it. Then I want to access that memory by using either <code>uint64_t</code> or <code>uint8_t[8]</code>.</p>
  
  <p>Using <code>unsigned long long int</code> and <code>unsigned char</code> would not be correct because <code>sizeof(unsigned char)==sizeof(uint8_t)</code> is not always true.</p>
  
  <p>I have a feeling that loops and copying memory is not really needed and I think that both</p>
  
  <p><code>uint64_t abc = { 0xdeadbeefcafe1337 }</code></p>
  
  <p>and</p>
  
  <p><code>uint8_t[8] xyz = { 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0x13, 0x37 }</code></p>
  
  <p>look the same in memory.</p>
  
  <p>Edit: But why?</p>
  
  <p>I want to make it easier to do simple addition on int and I would also like to access that int value in a simple array-like fashion, one-byte time.</p>