Reputation: 882
In visual studio code compiled successfully with
extern "C" char Table[256][256];
and if I replace the above code with
extern char Table[256][256];
visual studio starts to give me unresolved external errors for Table?
Upvotes: 3
Views: 174
Reputation: 63124
These are two unrelated meanings of the keyword extern
.
The first one is the language linkage specifier, which makes the variable interoperable with C.
The second one is the storage class specifier, which declares that the variable is defined elsewhere (which it wasn't, hence the "undefined reference" error).
You could actually use both to declare a variable with C linkage that is defined elsewhere:
extern "C" extern char Table[256][256];
Upvotes: 9