Mangled names always start with
_Z. Following this is
the mangled name of either a function and its type, an object
name, or a "special name".
There are a number of attributes that will be included in the mangled name of a function:
Within the mangling there are a lot of types. Some have a short name, others get their full name.
For more detail, you can do worse than Wikipedia: Name Mangling in C++
When you want to link with a C method, or be able to have a method called from C, you need to tag it as extern C. This tells the compiler not to mangle the symbol, so it will have a basic C looking symbol. For global variables there is no mangling and extern is redundant. But variables declared without extern are implicitly static. If they are initialized they will need symbols, and those symbols are mangled to avoid conflicting in the linker.