#include <iostream> using namespace std; namespace Config { int baudRate = 9600; int threshold = 50; } int main() { using namespace Config; cout << "Baud: " << baudRate << ", Threshold: " << threshold; return 0; }
Solution Explanation
Layman’s Terms
It’s like saying: “From now on, I’ll work inside the Config folder, so I don’t have to write the folder name every time.”
Significance for Embedded Developers
This makes code shorter when accessing many values from the same namespace (e.g., Config::UART::baudRate, Config::UART::parity).
But in large projects, it can cause conflicts if different modules have variables with the same name.
Test Cases
Test Results
Input
Expected Output
Baud: 9600, Threshold: 50