Home » C Programming » Preprocessors » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    #define Cprogram
    int main()
    {
    int p = 21;
    #ifdef Cprogram
    p = 11;
    printf("%d", Cprogram);
    }
    1. 21
    2. Garbage value
    3. 11
    4. Compilation Error
    5. None of these
Correct Option: D

Compilation Error

main.c: In function ‘main’:
main.c:8:30: error: expected expression before ‘)’ token
printf("%d", Cprogram);
^
main.c: At top level:
main.c:6:0: error: unterminated #ifdef
#ifdef Cprogram



Your comments will be displayed only after manual approval.