32. Square with Macro and Inline Function

 Your task is to extend the previous problem.

  • The macro SQUARE(x) and the inline function square(int x) are already declared.
  • In main():
    • Read an integer n.
    • Use two variables a and b, both initialized with n.
       

Call SQUARE(++a) and square(++b) and print the results in the format:

Macro Square: <value>
Inline Square: <value>

 

Example
 Input:

5

Output:

Macro Square: 49
Inline Square: 36

Macro function gives unexpected output

  • it increments twice, 5 -->  7.
  • The square of 7 is 49.

Inline function works as expected:

  •  increment once 5 --> 6
  • square(6) = 36
Loading...

Input

5

Expected Output

Macro Square: 49 Inline Square: 36