#include <iostream>
using namespace std;
void init(int pin) {
cout << "PIN " << pin;
}
void init(int* portPtr) {
cout << "PORT NULL";
}
int main() {
int mode;
cin >> mode;
if (mode == 1) {
int pin;
cin >> pin;
init(pin); // calls int overload
}
else if (mode == 2) {
init(nullptr); // calls pointer overload
}
return 0;
}
Explanation & Logic Summary:
int, one takes int*0 or NULL can select the wrong overloadnullptr enforces pointer overload selectionFirmware Relevance & Real-World Context:
0 can silently:nullptr eliminates these ambiguity-driven bugs
Input
1 7
Expected Output
PIN 7