#include #include #include void *fun(void *arg) { printf("Hi from fun\n"); int *x = new int(100); return (void *)x; } int main() { pthread_t thr; int code = pthread_create(&thr, NULL, fun, NULL); printf("Hi from main\n"); void *y; pthread_join(thr, &y); printf("y=%d\n", *(int *)y); }