Monday, February 15, 2010

23

#include< stdio.h >
#define merge(a,b) a##b
main()
{
int c=merge(4,0);
c=c+1;
printf("%d",c);
return 0;
}

Output:


41


Logic:


in previous post i said about merging operator. Again i'm going to explain what it's.
Merging Operator:
## this will merge given strings and produce concatenation of that strings.
in case of numbers it gives result in the form of numbers.
in this program, i defined a function merge, that'll merge the a and b using merging
operator(a##b). so it'll gives result as 40.

0 comments:

Post a Comment