Are Static Variables Thead Safe
Multithreading in itself is hard. But adding static variables into the mix, and we have chaos! One must always have a keen eye when dealing with them.
What is a static variable An ordinary variable is limited to the scope in which it is defined, while the scope of the static variable is throughout the program. When a variable is defined as static, memory is reserved for it at compile time.