首页 > 试题广场 >

定义宏#define DECLARE(name, ty...

[单选题]
定义宏#define DECLARE(name, type) type name##_##type##_type,
则DECLARE(val, int)替换结果为()
  • int val_int_type
  • int val_int_int
  • int name_int_int
  • int name_int_name
预处理运算中#表示文本参数字符串化,例如#define  cc(x)  printf(#x)  -------     cc(qwerdf)------->printf("qwerdf");
##表示连接两个字符串,有宏定义替换优先替换,例如#define cc(x1, x2) printf(x1##x2) -------cc(qwer, cf) ------>printf("qwercf")
 #define DECLARE(name, type) type name##_##type##_type,题目中,DECLARE(val, int),_type不是宏替换参数,所以保留_type
发表于 2019-08-25 22:41:24 回复(0)
题目应该是name##_##type##_##type
发表于 2019-10-22 10:27:57 回复(0)
最后一个没有双标 要注意 
发表于 2019-08-27 17:31:17 回复(0)