#include #include void* thread_func(void* arg) { int id = *(int*)arg; printf("Hello from thread %d\n", id); return NULL; } int main() { int N = 8; pthread_t threads[N]; int ids[N]; for (int i = 0; i < N; i++) { ids[i] = i; pthread_create(&threads[i], NULL, thread_func, &ids[i]); } for (int i = 0; i < N; i++) pthread_join(threads[i], NULL); return 0; }