File size: 432 Bytes
fba00e3
f067fcd
fba00e3
 
f067fcd
fba00e3
2aeedcc
fba00e3
2aeedcc
fba00e3
2aeedcc
fba00e3
2aeedcc
fba00e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.