Relative Content

Tag Archive for cwindowsmultithreading

Not passing correct argument through CreateThread

I was trying to create a function in C which would let me pass a character as its argument when using the CreateThread function.
It works for the most part, the thread is created and prints a character. The problem is, it many of the threads don’t print the character they are supposed to print, and instead print the last one. I assume it has something to do with how the character is passed on to the function, or perhaps the synchronization.
Here is the code: