LearnFrenzy
Sign in Take a free test

C Variables · Variables MCQ · Question 11

What does thread_local mean in C? Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links