zoukankan      html  css  js  c++  java
  • C语言宏定义时#(井号)和##(双井号)作用

    #的功能是将其后面的宏参数进行字符串化操作(Stringfication),简单说就是在对它所引用的宏变量 通过替换后在其左右各加上一个双引号。
    #define example(instr) printf("the input string is: %s ",#instr)
    #define example1(instr) #instr
    当使用该宏定义时:
    example(abc); 在编译时将会展开成:printf("the input string is: %s ","abc");
    string str=example1(abc); 将会展成:string str="abc";
    而##被称为连接符(concatenator),用来将两个Token连接为一个Token。
  • 相关阅读:
    spring mvc poi excel
    select onchange事件的使用
    eclipse下svn的分支与合并指南
    jquery_final
    ListView
    资源的使用
    Notification
    单选
    复选框
    调试
  • 原文地址:https://www.cnblogs.com/elesos/p/6867307.html
Copyright © 2011-2022 走看看