Warning: cast to/from pointer from/to integer of different size
A quick hacky fix might just to cast to long instead of int. On a lot of systems, sizeof(long) == sizeof(void *). A better idea might be to use intptr_t. int threadnumber = (intptr_t) param; and pthread_create(&(tid[i]), &attr, runner, (void *)(intptr_t)i);