Home » C Programming » Preprocessors » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    #define MINIMUM 30
    #ifdef(MINIMUM)
    #define MAXIMUM 250
    #endif
    int main()
    {
    printf("%d %d\n", MAXIMUM, MINIMUM);
    return 0;
    }
    1. Preprocessor error
    2. Garbage value
    3. Compilation Error
    4. 250 30
    5. None of these
Correct Option: C

Compilation Error

main.c:3:11: error: macro names must be identifiers
#ifdef(MINIMUM)
^
main.c: In function ‘main’:
main.c:8:27: error: ‘MAXIMUM’ undeclared (first use in this function); did you mean ‘MINIMUM’?
printf("%d %d\n", MAXIMUM, MINIMUM);
^~~~~~~
MINIMUM
main.c:8:27: note: each undeclared identifier is reported only once for each function it appears in



Your comments will be displayed only after manual approval.