#include<stdio.h>
#define FUN(arg) do{\ if(arg)\ printf(“CODECHEF…”, “\n”);\ }while(–i)
int main()
{
int i=2;
FUN(i<3);
return 0;
}
output-CODECHEF...CODECHEF...
#include<stdio.h>
#define FUN(arg) do{\ if(arg)\ printf(“CODECHEF…”, “\n”);\ }while(–i)
int main()
{
int i=2;
FUN(i<3);
return 0;
}
output-CODECHEF...CODECHEF...
hey hw to format this code … i dnt know …
printf(“CODECHEF…”, “\n”);
will print “CODECHEF…”; Since, there is no “%s” in the first parameter of the printf()
for the “\n” to apply.
The rest is rest self explanatory if you expand the macro.
but m not getting , y shlashes \ are there?? y they are used???
I believe this question is from indiabix.com and indiabix.com has forum discussion for each question just click “Discuss in forum” button below question.
perhaps m getting… they are for new line… i guess???
sure i will
It is same as :
do{
if(2 < 3)
printf("CODECHEF...", "\n");
}while(--2)
About Slashes :
Eg Syntax: #define name( parm1 , parm2 ) \
Spaces, tabs, and comments are replaced by a single space.
White space cannot appear between the name and the left parenthesis that introduces the parameter list. White space may appear inside the replacement list. Also, at least one space, tab, or comment must separate name from define .