Consider two different threads are running the same piece of code below. When it will print the following ?
1. x is 7
2. x is 8
3. x is 9
4. x is 10
1. x is 7
2. x is 8
3. x is 9
4. x is 10
shared int x; x = 10; while (1) { x = x - 1; x = x + 1; if (x != 10) printf(“x is %d”,x) }
No comments:
Post a Comment