printf("destinationaftermemcpy:%s\n",dest);
return 0;
}
输出结果:destinationbefore memcpy:abcdefghijlkmnopqrstuvwxyz0123as6
destination after memcpy: ******************************as6
extern void *memchr(const void *buf, intch, size_t count);
从buf所指内存区域的前count个字节查找字符ch。
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char*s="GoldenGlobalView";
cout<<strlen(s)<<endl;
return 0;
}
输出结果:16
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s[]="WelcomeToBeijing";
cout<<strrev(s)<<endl;
return 0;
}
输出结果:nijieBoTemocleW
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s1[]="abcdef";
char *s2=strupr(s1);
cout<<s2<<endl;
return 0;
}
输出结果:ABCDEF
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s1[]="ABCDEF";
char *s2=strlwr(s1);
cout<<s2<<endl;
return 0;
}
输出结果:abcdef
#include<stdio.h>
#include<string.h>
int main()
{
char*s="GoldenGlobalView";
char*l="lob";
char*p;
p=strstr(s,l);
if(p)
printf("%s",p);
else
printf("NotFound!");
return 0;
}
输出结果:lobalView
extern char *strcat(char *dest,char*src);
把src所指字符串添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char d[20]="GoldenGlobal";
char s[20]="View";
strcat(d,s);
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-34960-9.html
王八蛋的美国佬
现在又来中国海域闹事
電商等造福大眾的行業