Ans: Using extern “C”.
The function prototype must be preceded by extern “C”. More than one C functions can be grouped inside braces as shown below:
extern “C”
{
void f( ) ;
void f1( ) ;
}
// In cfunc.c
#include <stdio.h>
void f( )
{
printf ( “in f( )” ) ;
}
// In func.cpp
#include <iostream.h>
extern “C” void f( ) ;
void main( )
{
f( ) ;
}
Ensure that both .c and .cpp files are in the same project.