"#s" will return the literal being passed and not its value.
So for
#define STR(s) #s
usage
STR(a) will return string "a"
STR(ab) will return string "ab"
-SV
On Fri, Nov 25, 2005 at 8:46 PM, oposduero <[EMAIL PROTECTED]> wrote:
>
> > Hi. I have the following code:
> >
> > #include <stdio.h>
> > #define STR(s) #s
> >
> > main()
> > {
> > double a=0;
> > a=1.23;
> > printf("%s = %g",STR(a),a);
> > }
> >
> > If I run that code, I get:
> >
> > a=1.23
> > ---
> >
> > What does "#define STR(s) #s" do ?
> >
> > I have read chapter at K&R 2 ed. , and cant find the explanation.
> >
> > What does the line ?
> > #define STR(s) #s
> >
> > Where could I find a good explanation about #define on C language an
> > other preprocessor directives ?
> >
> > Alberto
> >
>
>
>
>
> To unsubscribe, send a blank message to <mailto:
> [EMAIL PROTECTED]>.
> Yahoo! Groups Links
>
>
>
>
--
Santosh Vernekar
QLogic
[Non-text portions of this message have been removed]