Overload Resolution Trap

#include <iostream>
using namespace std;

// define void foo(int x) -> prints "int overload"
void foo(int x) {
    cout << "int overload\n";
}

// define void foo(int* p) -> prints "int* overload"
void foo(int* p) {
    cout << "int* overload\n";
}

int main() {
    foo(0);         
    foo(nullptr);   
    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

int overload int* overload