adplus-dvertising
frame-decoration

Question

What is the output of C program with #undef?
#define BIRD 5
int main()
{
    #ifdef BIRD
        printf("BIRD=5.");
    #else
        printf("UNKNOWN.");
    #endif
    #undef BIRD
    #define BIRD 10
    printf("BIRD=%d",BIRD);
    return 0;
}

a.

BIRD=5.BIRD=5

b.

BIRD=10.BIRD=10

c.

BIRD=5.BIRD=10

d.

Compiler error

Answer: (c).BIRD=5.BIRD=10

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of C program with #undef?