# and ##
时间:2010-03-29 来源:liuyuanyang
The # and ## preprocessor operators are used with the #define preprocessor directive.
-
Using # causes the first argument after the # to be returned as a string in quotes.Using ## concatenates what's before the ## with what's after it.
For example, the command
#define to_string( s ) # swill make the compiler turn this command
cout << to_string( Hello World! ) << endl;into
cout << "Hello World!" << endl;Here is an example of the ## command:
#define concatenate( a, b ) a ## b ... int xy = 10; ...This code will make the compiler turn
cout << concatenate( x, y ) << endl;into
cout << xy << endl;which will, of course, display '10' to standard output.
相关阅读 更多 +- 系统休眠文件删除后果 如何删除计算机的休眠文件 2025-04-22
- 站群服务器是什么意思 站群服务器的作用 站群服务器和普通服务器的区别 2025-04-22
- jQuery插件有何作用 jQuery插件的使用方法 2025-04-22
- jQuery插件有哪些种类 简单的jQuery插件实例 2025-04-22
-