Computer Science, asked by kbjoshi7714, 11 months ago

How Do You Link A C++ Program To C Functions?

Answers

Answered by liza10987654321
0

Just declare the C++ function extern "C" (in your C++ code) and call it (from your C or C++ code). For example: // C++ code: extern "C" void f(int);

...

Now f() can be used like this:

1) /* C code: */

2) void f(int);

3)void cc(int i)

4) {

5) f(i);

6) /* ... */

7) }

Similar questions