We have already declared a namespace MathOps with:
int x = 10;
int square(int n)
n * n
Your task is to:
x
square(x)
Example Output:
x=10 Square=100
Why this output?Because the variable x is accessed using MathOps::x, and the function is called using MathOps::square(10).
MathOps::x
MathOps::square(10)
Question SignificanceDemonstrates how to access variables and functions defined inside a namespace using the scope resolution operator.
Test Cases
Test Results
Input
Expected Output