📄 sharp.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> <title>#, ##</title> <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table> <tr> <td> <div class="body-content"> <div class="header-box"> <a href="../index.html">cppreference.com</a> > <a href= "index.html">C/C++ Pre-processor Commands</a> > <a href= "sharp.html">#, ##</a> </div> <div class="name-format"> #, ## </div> <p>The # and ## operators are used with the <a href= "define.html">#define</a> macro. 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.</p> <div class="related-examples-format"> Example code: </div> <div class="related-examples"> <p>For example, the command</p> <pre class="example-code"> #define to_string( s ) # s </pre> <p>will make the compiler turn this command</p> <pre class="example-code"> cout << to_string( Hello World! ) << endl; </pre> <p>into</p> <pre class="example-code"> cout << "Hello World!" << endl; </pre> <p>Here is an example of the ## command:</p> <pre class="example-code"> #define concatenate( x, y ) x ## y ... int xy = 10; ... </pre> <p>This code will make the compiler turn</p> <pre class="example-code"> cout << concatenate( x, y ) << endl; </pre> <p>into</p> <pre class="example-code"> cout << xy << endl; </pre> <p>which will, of course, display '10' to standard output.</p> </div> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="define.html">#define</a> </div> </div> </td> </tr> </table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -