What value will be printed? | |
code snippet image | |
(Assume necessary headers are included) | |
This code will always print 3, because the thread t is started before the value of y is modified. | |
This code won’t compile. | |
This code will always print 7, because the thread t is joined after both modifications of y. | |
This code will print 3, 6 or 7 (depending on thread scheduling by the operating system) | |
This code has undefined behavior. |