This is from the <iostream>:
namespace std
{
extern istream cin; ///< Linked to standard input
extern ostream cout;
...
It seems by using extern the data types defined in other namespaces will just be available?
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.
externis used to refer to a variable defined in a different compilation unit (for now, you can think of a compilation unit as a .cpp file). The statements in your example declare rather than definecinandcout. It is telling the compiler that the definition of these objects is found in another compilation unit (where they are not declared asextern).