extern void f( unsigned int );
extern void f( int );
extern void f( char );

int main() {
    unsigned char uc;
    f( uc );
    return 0;
}
Which variant of the overloaded function f will be called?
(provided that unsigned char occupies 1 byte and int occupies 4 bytes)
Explanation
The void f( int ) function will be called because its formal parameter provides the best match to the type of the actual parameter, since unsigned char is converted to int by type extension, and unsigned int and char by standard type conversion.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes