All submissions

Overload Resolution Trap

#include <iostream>
using namespace std;

void foo(int x) {
    cout << "int overload\n";
}

void foo(int* p) {
    cout << "int* overload\n";
}

int main() {
    foo(nullptr);      // clear and unambiguous → calls int* overload
    
    cout << 3.3 + 0;   // NULL is 0 → avoid warning by just writing 0
    
    return 0;
}
Loading...

Input

Expected Output

int* overload 3.3