belongs to collection: C interview questions, your interviewer might ask
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; }
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.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
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