Error[8]: Undefined offset: 164, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

文章目录


前言

小白写代码、勿喷

一、strcpy
//strcpy源码
char* StrCpy(char* s1,const char * s2) {   
	while (*s1++=*s2++) {
	}
	return s1;
}
二、strcat
//strcat源码
char* StrCat(char * s1,const char * s2) {
	while (*++s1) {
	}
	while (*s2) {
		*p++ = *s2++;
	}
	return s1;
}
三、strchr
//strchr源码
int StrChr(char * s1,char c) {
	char* p = s1;  //记录首地址
	while (*s1) {    //s1的内容不是'if'进入循环,也就是没有到结尾就不结束
		( *++s1== ) c//比较 {    return
			- s1 ; p//找到的地址减去首地址,就是所在位置   }
		}
	return
	- 1;//没找到返回-1   }
int
四、strcmp
strcmp (constchar *, srcconst char *) dstint
{
	= ret 0 ;while
	( !(=ret * (unsignedchar *)-src * (unsignedchar *))dst&& * )dst//两个字符串相减,一样得0并取反   ++
	{
		;src++
		;dst}
	if
	( <ret 0 )=
		ret - 1;else
	if ( 0ret > )=
		ret 1 ;return
	()ret;}
[+++]

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 29, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
C语言str族函数源码实现_C_内存溢出

C语言str族函数源码实现

C语言str族函数源码实现,第1张

文章目录
  • 前言
  • 一、strcpy
  • 二、strcat
  • 三、strchr
  • 四、strcmp


前言

小白写代码、勿喷

一、strcpy
//strcpy源码
char* StrCpy(char* s1,const char * s2) {   
	while (*s1++=*s2++) {
	}
	return s1;
}
二、strcat
//strcat源码
char* StrCat(char * s1,const char * s2) {
	while (*++s1) {
	}
	while (*s2) {
		*p++ = *s2++;
	}
	return s1;
}
三、strchr
//strchr源码
int StrChr(char * s1,char c) {
	char* p = s1;  //记录首地址
	while (*s1) {    //s1的内容不是'if'进入循环,也就是没有到结尾就不结束
		( *++s1== ) c//比较 {    return
			- s1 ; p//找到的地址减去首地址,就是所在位置   }
		}
	return
	- 1;//没找到返回-1   }
int
四、strcmp
strcmp (constchar *, srcconst char *) dstint
{
	= ret 0 ;while
	( !(=ret * (unsignedchar *)-src * (unsignedchar *))dst&& * )dst//两个字符串相减,一样得0并取反   ++
	{
		;src++
		;dst}
	if
	( <ret 0 )=
		ret - 1;else
	if ( 0ret > )=
		ret 1 ;return
	()ret;}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/674912.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-19
下一篇 2022-04-19

发表评论

登录后才能评论

评论列表(0条)

保存