Q:

What is the output of the below C code?

0

What is the output of the below C code?

#include <stdio.h>
#define PRINT(var,data) do {\
                            if(var < data)\
                                {\
                                    printf("Aticleworld");\
                                    ++var;\
                                }\
                            }while(1);
int main()
{
    PRINT(0,2);
    return 0;
}

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Output:  compiler Error.

Explanation: When macro will be expanded, var will be replaced with 0 (Rvalue). Because you are trying to increment the Rvalue, you will get a compiler error. You can read this article for more detail, post, and pre-increment operators.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What do you mean by enumeration in C?... >>
<< What is the difference between a macro and a funct...