Home » C Programming » Preprocessors » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int calc(int, int);
    #define calc(p, q) p / q + p
    int main()
    {
    int a = -17, b = 12;
    printf("%d ",calc(a + b, 12));
    #undef calc
    printf("%d\n",calc(a + b, 12));
    }
    int calc(int p, int q)
    {
    return p / q + p;
    }
    1. Compilation Error
    2. -17 12
    3. -21 -5
    4. Garbage value
    5. None of these
Correct Option: C

-21 -5



Your comments will be displayed only after manual approval.