Advertisement

extern?

Started by April 07, 2002 05:57 AM
0 comments, last by Tac-Tics 22 years, 7 months ago
Here''s a quicky. In C, what does the extern keyword signify? Does it have any meaning in C++? Thnx
This means the linker should look for a variable in another object file.

Example:

// In test1.cpp
int test = 123;

// In test2.cpp
extern int test;

There are other uses of extern though, like to force the compiler to use c linkage in c++ files.

// In some c++ file
extern "C"
{
void MyFunc (int i);
}

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

This topic is closed to new replies.

Advertisement