Multiple choice technology programming languages

consider the following line in the c++ code extern "C" { f1(); f2();... } The purpose of the extern keyword is

  1. They tell the C++ compiler that they are functions compiled by a C compiler , So that they can be used in C++

  2. they mean that the function are declared somewhere and defined somewhere

  3. They improve performance

  4. They are used with extern variables.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The extern C linkage specification tells the C++ compiler that the enclosed functions were compiled by a C compiler and should use C linkage rules. This disables C++ name mangling, allowing C++ code to link with C functions. Without this, C++ would mangle the function names, and the linker couldn't find the C functions.