Tell me how can a C function be called in a C++ program?
Submitted by: MuhammadUsing 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);
}
Submitted by: Muhammad
//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);
}
Submitted by: Muhammad
Read Online C++ Programmer Job Interview Questions And Answers
Top C++ Programmer Questions
☺ | Explain me what is an Object/Instance? |
☺ | Explain void free (void* ptr)? |
☺ | Tell me how to create a pure virtual function? |
☺ | Tell me what will the line of code below print out and why? |
☺ | Please explain is there a difference between class and struct? |
Top C Plus Plus Language Categories
☺ | C++ Pointers & Functions Interview Questions. |
☺ | C++ Operator Overloading Interview Questions. |
☺ | C++ Exception Handling Interview Questions. |
☺ | C++ Template Interview Questions. |
☺ | C++ Virtual Functions Interview Questions. |