Sign in to follow this  
BloodLust666

extern

Recommended Posts

Quote:
Original post by LessBread
Declare the actual variable in one file and use extern in many other files to access it.

<pedantic>define the variable in one file and use extern declarations to access it from other files.

When you have just
long Var;
it's a definition and can only show up (in a given namespace scope) once in your entire program.

When you have
extern long Var;
it's a declaration and can show up in as many files or as many times in one file as you want.
</pedantic>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this