#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 *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
What is the main difference between STRUCTURE and UNION?
What is your nationality?
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']
Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
What is the output of the program given below main() { signed char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Write a function to find the depth of a binary tree.
13 Answers Adobe, Amazon, EFI, Imagination Technologies,