Question 11
Back to Exercise
What does thread_local int errors; declare (C23; _Thread_local in C11)?
- A A variable shared by all threads
- B A variable of which each thread has its own separate copy Correct
- C A variable that only the main thread can use
- D A constant
Correct Answer: Option B
Thread storage duration gives every thread its own instance, created when the thread starts. It is how errno works safely in multithreaded programs.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!