Considering the recent litigation in which Google apparently claimed that all the emails, all the data in them, are Google's property and can do with the data whatever they want, I get frequent questions from our employees how does this translate into Gmail for business which we're using. Is the data in our corporate account also Google's property?

http://www.theregister.co.uk/2013/08/14/google_cloud_users_have_no_legitimate_expectation_of_privacy/


Question: Word counting program using multi threading: Large file size
Answer: Typecasting does not fix wrong code - it only disguises it or makes it even more wrong. Let's look at those errors:

struct thread_data* td=(struct thread_data)data; /* wrong */


You can't cast a struct thread_data * to a struct thread_data, neither can you assign a struct thread_data to a struct thread_data *. The incorrect and unnecessary cast is the sole cause of the error.

x = pthread_create(&amp;threads[id], NULL, &amp;countFrequency, (void *)data); /* wrong */


Secondly, nor can you cast a struct thread_data to a void * - you need an actual pointer, like the address of data:

x = pthread_create(&amp;threads[id], NULL, &amp;countFrequency, &amp;data);


No cast, either, because pointers to data types convert to void * naturally. Of course, since there's only one copy of data all the threads are going to share it, and all work on whatever the last values written to it were. That's not going to go well - you'll want one struct thread_data per thread.

Thirdly, those warnings are telling you your thread function has the wrong signature:

void *countFrequency(struct thread_data *data) /* wrong */


Combined with the first point, get all the types correct and yet again no casts are needed.

void *countFrequency(void *data) {
    struct thread_data* td = data;