27. Multiple Namespaces

Your task is to declare two namespaces:

  • namespace UART with variable int baudRate = 115200;
  • namespace SPI with variable int clockSpeed = 1000000;
     

Example

Output:

UART Baud: 115200
SPI Clock: 1000000

 

Why this output?

Because variables from each namespace are accessed explicitly: UART::baudRate and SPI::clockSpeed.

 

Question Significance

This shows how multiple namespaces keep values organized and prevent naming collisions.

Loading...

Input

Expected Output

UART Baud: 115200 SPI Clock: 1000000