You are not logged in.

#1 2015-04-18 05:23:03

hasnain
Administrator
From: Chichawatni
Registered: 2014-10-13
Posts: 8,355
Website

Output Of The Program?

Directions:

#define f(g,g2) g##g2
void main()
{
   int var12=100;
   printf("%d", f(var,12));
}

Question:
The output of the following program is:

Option A):
100
Option B):
Runtime error
Option C):
10012
Option D):
g##g2

Correct Answer is Option A):
100

Explanation:
## is token pasting operator which simply combines all the parameters of macro into one variable.
So, in f(var, 12), var and 12 combines to form var12 and replaces the f(var, 12) and hence the output is 100.


Failure is the first step towards seccess.

2015-04-18 05:23:03

Advertisement
Ads By Google

Re: Output Of The Program?



\n

Board footer