Is extern "C"
required also for linking global variables used in Cpp file to the one defined in a c file?
Portably, yes.
You might find that leaving out extern "C"
works for your compiler (for example, GCC, which doesn't mangle C++ variable names in the global namespace), but that's not something you can rely on for all compilers.
Does the C compiler also changes the name of variables??
It depends on the compiler (specifically, on the ABI it uses). The language standards don't specify how language-level names map to linker symbols, so different compilers can use different name-mangling schemes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…