Multiple choice

Assume all the relevant header files are included.

In the following code, which function will be called? void print(int) {} void print(int&) {} int iobj; int &ri = iobj;

int main() {

print(iobj);

}

  1. Print(int)

  2. Print(int&)

  3. Compilation error: Ambiguous

  4. Runtime error

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Both the functions can be called. So, the compiler flags an error.