Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   what is # # in C (http://www.go4expert.com/forums/c-t762/)

priyapai 27Apr2006 16:58

what is # # in C
 
Hi all,

today i was going thru a code, wer i found this macro definition,


#define _L(a) (TPtrC((const TText *)L ## a))

where TPtrC and TText r user defined data-types,

wat is the ## symbol for..... :confused:



-priya

shabbir 27Apr2006 19:50

Re: what is # # in C
 
Can you let us have the complete context where you found this.

Offtopic comment:
Also try creating the thread in the correct section and only one. I have closed the other thread as duplicate and moved them to the correct section as well.

sharmila 28Apr2006 09:25

Re: what is # # in C
 
## is a concatination preprocessor operator.
#define _L(a) (TPtrC((const TText *)L ## a)) means
here the value of 'a' is appended to (const TText *)L and the whole thing is passed to TPtrC function.

For more clarification you can go through the link
http://developer.apple.com/documenta...#Concatenation

coderzone 28Apr2006 10:44

Re: what is # # in C
 
I didn't knew about ## operator. Thanks for the info sharmila.

sharmila 28Apr2006 14:17

Re: what is # # in C
 
Its my pleasure.

priyapai 28Apr2006 14:49

Re: what is # # in C
 
i was asked by my senior to review a piece of code, and the statement was part of it....

it is clear to me now.

Thanx :-)

shabbir 28Apr2006 20:39

Re: what is # # in C
 
Quote:

Originally Posted by coderzone
I didn't knew about ## operator. Thanks for the info sharmila.

Nor did I knew about it.

Aztec 9May2006 22:00

Re: what is # # in C
 
Sample code to make things more clear:-

Code:

#include<stdio.h>
#define JOIN(a, b) a ## b
int main()
{

printf("%s",JOIN("Hi","Everyone"));

return 0;
}


priyapai 10May2006 09:07

Re: what is # # in C
 
thanx Aztec... :)

Its clear to me....

Thanx Forum members for responding to my query


regards
Priya :)


All times are GMT +5.5. The time now is 09:28.