Are static variables allocated in the heap or on a thread specific stack.

Thanks

Easy to test? Create two threads that run a function with a static variable, print the value of the variable and then increment it.
Make sure the first thread is finished before starting the second.

Well I have already tested using a different thread. It it seems that it works, so I assume that they are created on the heap, but the way I use my _beginthreadex function and pass it an instance of my class, I am not sure where it is created.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.