Q:

Can we combine C and C++ code?

0

Can we combine C and C++ code?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer : 

Yes, we can combine C and C++ source code. You need to use extern “C”  for the same. Let see an example,

// C++ code
 extern "C" void foo(int); // one way, foo is C function
 extern "C" {    // another way, fun and test are C functions
     int fun(double);
     double test();
 };

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions For Experienced

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How can I include a non-system C header file in my... >>
<< What is the difference between function overloadin...