I want to understand the external linkage and internal linkage and their difference.
I also want to know the meaning of
constvariables internally link by default unless otherwise declared asextern.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you write an implementation file (
.cpp,.cxx, etc) your compiler generates a translation unit. This is the source file from your implementation plus all the headers you#included in it.Internal linkage refers to everything only in scope of a translation unit.
External linkage refers to things that exist beyond a particular translation unit. In other words, accessible through the whole program, which is the combination of all translation units (or object files).