How about this one, i have returned the value and calculated at the end, but still there is some syntax error. What is the mistake i am doing in this snippet?
We're nearly there, but there are few things that aren't quite right. I'll do them one at a time.
I think you don't really understand how to pass data to and from the thread function. Let's do that first.
In the thread example I posted, I showed how the thread function can receive and pass information back to the caller thread. We create a struct and share it between both threads. But as we never access the data at the same time from the main thread and a worker thread, we don't need to synchronise access to it. http://www.cplusplus.com/forum/unices/75447/#msg405258
We should use this mechanism to get the counts back from each thread.
Yes you are right, i am having an issue while returning, it says error in converting double to void, so thats the reason i am returning return &pointsIn;
Regarding the addition of the result from all the 4 threads is bit out of my range at the moment.