I am writing a general C ++ library to use a C program. However, I have a question about externand extern "C".
Consider the following code
My header file is as follows:
#ifdef __cplusplus
extern "C" int global;
extern "C" int addnumbers(int a, int b);
#else
extern int global;
#endif
This works great; I just need to declare
int global;
in my .cpp or my .c file. However, I do not understand:
What is the difference between extern "C"and externhere? I tried to comment extern "C" int globaland it works! What for?
, extern "C" C-. extern "C" int addnumbers(int,int). , ++-, C, extern "C". , - , ? , C ++ global, extern not extern "C". ? .
: , , , , .