2 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for saurabh.mehta.33234

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 …

Member Avatar for JamesCherrill
0
207
Member Avatar for rhoit

[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]

Member Avatar for rhoit
0
529

The End.