美文网首页
Strcat & Strncat

Strcat & Strncat

作者: Littleston | 来源:发表于2018-10-15 21:39 被阅读0次

strcat 

将两个char类型连接。

char d[20]="GoldenGlobal"; char *s="View"; strcat(d,s);

结果放在d中

printf("%s",d);

输出 d 为 GoldenGlobalView (中间无空格)

d和s所指内存区域不可以重叠且d必须有足够的空间来容纳s的字符串。

返回指向d的指针

strncat(A,B,*)      与strncpy不同,在这里直接加上number即可,不用再加'\0'

相关文章

网友评论

      本文标题:Strcat & Strncat

      本文链接:https://www.haomeiwen.com/subject/ozpqzftx.html