Answers

Question and Answer:

  Home  C++ Programmer

⟩ Tell me how can a C function be called in a C++ program?

Using an extern "C" declaration:

//C code

void func(int i)

{

//code

}

void print(int i)

{

//code

}

//C++ code

extern "C"{

void func(int i);

void print(int i);

}

void myfunc(int i)

{

func(i);

print(i);

}

 273 views

More Questions for you: