Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Practice this question and more.


What type of linkage does the static variable 's' have within the 'oneChar' function?

  1. Internal linkage

  2. External linkage

  3. No linkage

  4. Public linkage

The correct answer is: No linkage

Static variables have no linkage, meaning they can only be accessed or modified within the function in which they are declared. Option A is incorrect because internal linkage refers to variables that can only be accessed within the same translation unit, not just within the same function. Option B is incorrect because external linkage refers to variables that can be accessed in other translation units. Option D is incorrect because public linkage is not a type of linkage for variables.