explicit is used for constructors to signify that it won't automatically make the conversion to the class type, ie you have to explicitly use the constructor
An implicit function is one where the compiler assumes that the function is declared&defined elsewhere. That is, the compiler doesn't know anything more about the function than what it can figure out when you call it.
In the example, since printf() was never declared, the compiler had to try to figure out what kind of function it is. It looks like
void printf( const char* );
We know different, but that is close enough so it works. (Usually. A C program is automatically linked with the actual printf() function.)
Now, if we want to fix the above, we can declare the function properly -- that is, explicitly:
1 2 3 4 5 6 7
int printf( constchar*, ... ); /* here the function is explicitly declared */
int main()
{
printf( "Hello world!\n" ); /* now it can be used, since the compiler knows about it */
return 0;
}
Keep in mind that the function must still be defined somewhere. In the case of printf() it is defined in the standard library that is automatically linked with your C program. For functions you create yourself you must also declare them:
1 2 3 4 5 6 7 8 9 10 11 12
void print_sum( int a, int b ); /* explicit declaration */
int main()
{
print_sum( 27, 15 ); /* happy compiler */
return 0;
}
void print_sum( int a, int b ) /* definition */
{
printf( "%d + %d = %d\n", a, b, a + b ); /* implicit function use */
}