On my pc I had experimented with the CreateThread function that creates a thread. I tried something like this in main() program and in the ThreadFunc()
wsprintf(buffer,"var1 = %d , var2 = %d", var1, var2);
I have not explicitly allocated memory for "buffer". But it seemed to work in main(), but it did not work ThreadFunc(). Why is this so?
I am writing this post because I am concerned about memory leaks. If I had allocated memory in ThreadFunc() (but not deallocated it), and the thread function completes its execution, would the memory I had allocated be deallocated.