2 Discussion / Question Topics
Remove Filter
|
|
I am trying to learn Volatile keyword in Multi Threading and I came across this statement: *Volatile is preferred in cases when one thread reads and writes a shared variable and other threads just read the same. Whereas if there are more than 2 threads performing read and write both … |
|
[CODE] #include <iostream> int main() { for(int i; i<3; i++){ volatile char str[]="hello\n"; std::cout<<str<<std::endl; } return 0; } [/CODE] Why? its gives output [ICODE] 1 1 1 [/ICODE] |
The End.