Explaing Preprocessor Symbol ‘#’


The # symbol can be used in front of a normal macro argument to convert the actual argument to string.

#define PRINT(X) printf ( #X ” = %s”, X ) ;

void main( )

{

char *name = “Jeff Prosise” ;

PRINT ( name )

}

The output of the above program is

name = “Jeff Prosise”

This entry was posted in C Programming and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>