这些是宏的功能。
比如这样:
#include <stdio.h>
#define STR(a,b) a##b
int main()
{
printf("%s\n",STR("123","456"))
return 0
}
字符串连接:即将字符串b复制到另一个字符a的末尾,并且字符串a需要有足够的空间容纳字符串a和字符串b。
#include<stdio.h>void mystrcat(char a[],char b[]){//把a和b拼接起来
int i=0,j=0
while(a[i++]!='\0')
i--
while(b[j]!='\0'){
a[i++]=b[j++]
}
a[i]='\0'
}
int main()
{
char a[100],b[100]
gets(a)
gets(b)
mystrcat(a,b)
puts(a)
return 0
}
/*
运行结果:
abc
def
abcdef
*/