#include <pthread.h>
#include "../header/tlpi_hdr.h"
static void *
threadFunc(void *arg)
{
    char *s = (char *) arg;
    printf("%s", s); 
    return (void *) strlen(s);
}
int
main(int argc, char *argv[])
{
    pthread_t t1; 
    void *res;
    int s;
    s = pthread_create(&t1, NULL, threadFunc, "Hello world\n");
    if (s != 0)
        errExitEN(s, "pthread_create");
    printf("Message from main()\n");
    s = pthread_join(t1, &res);
    if (s != 0)
        errExitEN(s, "pthread_join");
    printf("Thread returned %ld\n", (long) res);
    exit(EXIT_SUCCESS);
}
Above code is just what I'm studying now, but I can't understand about conversion of data type.
On threadFunc(), the return type is void *. But from this function, strlen(s) is type size_t. But how this can be changed to (void *). I mean, why not (void *) &strlen(s) ?
And, also in the main(), there is printf("Thread returned %ld\n", (long) res);.
From this, variable res is the type (void *), not int or long. So, it should be changed like this:
(long) *res.
But, how this can be changed to (long) res?
 
     
     
     
    