extern in cpp

Posted by: acid45

extern in cpp - 01/01/04 06:07 AM

When using the extern is it similar to the define funtion only the extern's first variable is the variable already declared in a headerfile included above and the second part is the new name for easier codding of newer objects and things like that.
The first time I saw it all it said was:
Code:
 extern C {
I had no idea, and still don't what this did. While looking at some direct draw I saw some variables like:
Code:
extern DDRAWSURFACEDESC ddsd;
I looked in the ddraw.h file and found that so I think I am correct in what extern does, in part anyway.

PS: I think I may have a keylogger of some sort, I don't think it is activly sending information but it is fairly annoying that everytime I hit enter I lose the focus of ALL windows, even full screen games. I don't see any unusual activity but I'd like to get rid of this annoyance.
Posted by: Predator

Re: extern in cpp - 01/01/04 10:51 PM

Global variables are available to all parts of the program. If the existence of a global variable in one file is declared using the extern keyword in another file, the data is available for use by the second file.
Posted by: acid45

Re: extern in cpp - 01/04/04 06:10 AM

So extern is used to use global variables in more than one program from a single file: IE header files?
Posted by: SilentRage

Re: extern in cpp - 01/08/04 05:00 AM

extern is used to use global variables IN one program that consists of more than one .C or .CPP file.
Posted by: raquel

Re: extern in cpp - 01/26/04 02:41 PM

hi guys im new here