Как правильно преобразовать / преобразовать int
в size_t
в C99 на обе 32-битные и 64-битные платформы linux?
Пример:
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];
}