#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 |
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.
21 Answers ABC, eBay, Goldman Sachs, Google, HUP, Microsoft, TATA,
Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.
5 Answers IITR, Microsoft, Nike,
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
Derive expression for converting RGB color parameters to HSV values
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?
Give a one-line C expression to test whether a number is a power of 2.
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h
void main() { int i=i++,j=j++,k=k++; printf(ā%d%d%dā,i,j,k); }
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
18 Answers HCL, IBM, Infosys, LG Soft, Satyam,
Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?