|
-
September 20th, 2007, 06:31 AM
#1
what are the possible outputs
Hi,
Suppuse I have the following function
static int staticIntX = 2;
int inc()
{
staticIntX++;
return staticIntX;
}
What are the possible outputs for this function if 2 different threads are calling it?
I understand that there are 3 possible answers:
2,2
2,3
3,3
the thing is that I do not undertand how the 2,2 result can happen.
Can anyone explain?
Thanks
Avi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|