Home » C Programming » Preprocessors » Question
  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    #define SQR(k) (k * k)
    int main( )
    {
    int p, q = 5 ;
    p = SQR (q + 3) ;
    printf ("%d\n" , p) ;
    return 0 ;
    }
    1. 64
    2. 23
    3. Error
    4. Garbage value
Correct Option: B

Because, on preprocessing the expression becomes p = (5 + 3 * 5 + 3 )
i.e. p = 5 + 15 + 3 = 23



Your comments will be displayed only after manual approval.