#define f(g,g2) g##g2

main()

{

int var12=100;

printf("%d",f(var,12));

}

Answers were Sorted based on User's Feedback



#define f(g,g2) g##g2 main() { int var12=100; printf("%d&qu..

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

#define f(g,g2) g##g2 main() { int var12=100; printf("%d&qu..

Answer / susie

Answer :

100

Is This Answer Correct ?    39 Yes 2 No

#define f(g,g2) g##g2 main() { int var12=100; printf("%d&qu..

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

Post New Answer

More C Code Interview Questions

Write a program that reads a dynamic array of 40 integers and displays only even integers

2 Answers  


struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error

3 Answers   HCL,


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

2 Answers  


How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...

6 Answers   Microsoft, MSD, Oracle,






programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,


what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  


x=2 y=3 z=2 x++ + y++; printf("%d%d" x,y);

2 Answers  


main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }

29 Answers   IBM, TCS, UGC NET, Wipro,


Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector

2 Answers  


Categories