#define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
Answers were Sorted based on User's Feedback
Answer / arnab maji
Hey Susie,
The ## is a concatenation operator,
When you pass the two arguments they get concatenated as
i/p --> f(g,g2) g##g2
o/p --> gg2
hence
f(var,12) will give us var12
effectively the printf statement gets modified as
printf("%d",f(var,12)); --> printf("%d",var12);
hence the output is 100 ie the value of var12.
Is This Answer Correct ? | 56 Yes | 3 No |
Answer / vignesh1988i
the answer is 10012, the printf statement must be :
printf("%d",f(var12,12));
the number 12 will be concatenated by 100.
thank u.
Is This Answer Correct ? | 7 Yes | 17 No |
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }
what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }
int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.
Find your day from your DOB?
15 Answers Accenture, Microsoft,
How do you write a program which produces its own source code as its output?
main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }
Print an integer using only putchar. Try doing it without using extra storage.
main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above
Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number