❶ c语言定义宏 #define call(x,y) x##y表示什么
c语言中,##表示把两个宏参数贴合在一起,即,
#define call(x,y) x##y ,执行call(x,y)结果为xy,例如,
int x=2,y=5;
int xy=90;
printf("%d\n",call(x,y));//结果为90
##被称为连接符,用来将两个宏参数连接为一个宏参数。
而单个#的功能是将其后面的宏参数进行字符串化操作,简单地说就是在对它所引用的宏变量通过替换后在其左右各加上一个双引号,使其成为字符串。
❷ 求解一个c语言的字符串问题
代码文本:
#include "stdio.h"
#include <string.h>
int main(int argc,char *argv[]){
char a[600],b[50],c[50],t[600],*pt;
printf("Please enter 3 strings... ");
scanf("%500s%49s%49s",a,b,c);
while(pt=strstr(a,b)){
strcpy(t,pt+strlen(b));
strcat(strcpy(pt,c),t);
}
printf("The result is: %s ",a);
return 0;
}