TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Andrew
NA
3
0
question from interview
May 6 2009 4:13 AM
Hi all
it's my first time here and here's a question that I was asked yesterday
it's kind of pseudocode
____________________________________________
int globalVar = 0;
void Func() {
for (int i = 0; i < 10; i++)
globalVar = globalVar + 1;
}
void main() {
Thread x = new Thread(Func); x.Start();
Thread y = new Thread(Func); y.Start();
x.Join();
y.Join();
Write(globalVar);
}
____________________________________________
the final globalVar has values from 1 to 20.
I understand how it can be from 10 to 20, but
can you explain how can it be less than 10?
thanks
Reply
Answers (
2
)
Asynchronous TreeView Nodes
How to bind Data from a database to MS Word in a given Template?