Without conflicting with other good answers, I will add a bit of my example.
What exactly C++ Compiler does: it mangles the names in the compilation process, hence we require telling the compiler to treat C
implementation specially.
When we are making C++ classes and adding extern "C"
, we're telling our C++ compiler that we are using C calling convention.
Reason (we are calling C implementation from C++): either we want to call C function from C++ or calling C++ function from C (C++ classes ... etc do not work in C).