Tuesday, February 3, 2009

[C/C++] Charizing Operator (#@)

#@ is charizing operator has its application when used with arguments of macros. If #@ precedes a formal parameter in the definition of the macro, the actual argument is enclosed in single quotation marks and treated as a character when the macro is expanded. Check the below code and output,

Code:
    #define MAKE_CHAR(X)  #@X
char cVal;
cVal = MAKE_CHAR( R );
MessageBox( CString(cVal),"Charizing Test" );
Output message box:
 
 

No comments: