#include #include #define THREADS 4 void* f(void* id) { int num; scanf("%d", &num); printf("Thread %ld read %d!", (long) id, num); pthread_exit(NULL); } int main() { pthread_t threads[THREADS]; long t; for (t = 0; t < THREADS; t++) { pthread_create(&threads[t], NULL, f, (void *)t); } pthread_exit(NULL); }