title: C: cast int to size_t
body: <p>What is the proper way to convert/cast an <code>int</code> to a <code>size_t</code> in C99 on both 32bit and 64bit linux platforms?</p>
  
  <p>Example:</p>
  
  <pre><code>int hash(void * key) {
      //...
  }
  
  int main (int argc, char * argv[]) {
      size_t size = 10;
      void * items[size];
      //...
      void * key = ...;
      // Is this the right way to convert the returned int from the hash function
      // to a size_t?
      size_t key_index = (size_t)hash(key) % size;
      void * item = items[key_index];
  }
  </code></pre>