¡¾ÌâÄ¿4¡¿ÈçºÎ×Ô¼ºÊµÏÖCº¯Êýstrstr()
½âÌâ˼·£º Õâ¸öÍøÂçÉÏÒѾÓкܶà´ð°¸£¬ÕâÀï
ÁоÙÒ»¸ö¸´ÔÓ¶ÈΪ0(m*n)µÄÀý×Ó¡£ÊµÏÖµÄÔÀí
ºÜ¼òµ¥£¬Ë³Ðò±éÀúÒª²éÕÒµÄ×Ö·û´®£¬Èç¹ûûÓÐÕÒ
µ½£¬×Ö·û´®Ö¸ÕëÍùǰһ룬ÔÙÍùºó±È½ÏÒª²éÕÒµÄ
×Ö·û´®£¨Ä£Ê½´®£©£¬ÈçÏÂͼËùʾ£º
a b c d d d a d a c a b d a d d d a d c k
->
d a d a
char* strstr(const char* s1, const char* s2)
{
if(s1 == NULL || s2 == NULL)
return NULL;
while(*s1)
{
while(1)
{
int i = 0;
if(s2[i] == NULL)
return (char*)s1;
if(s2[i] != s1[i])
break;
i++;
}
s1++;
}
return NULL;
}
Ïà¹ØÎĵµ£º
Ö÷Ò³£º http://www.christian-heffner.de/
ÏÂÔØÁ´½Ó£º http://www.christian-heffner.de/index.php?page=download¡´=en
¼ò½é£º
»ùÓÚLCCµÄÒ»¿îC±àÒëÆ÷£¬Óбê×¼µÄIDE½çÃæ£¬ÀàËÆVCµÄ½çÃæ£¬µ±È»ºÍDEV-C++»¹ÓÐMingW32 studio½çÃæÒ²ºÜÏñ£¬¿ÉÒÔÓÃÓÚ´´½¨Ð¡Ò»µãµÄ»ùÓÚCµÄ¹¤³Ì¡£
IDE´úÂë±à¼½ ......
C/C++Ô¤´¦Àí ISO/ANSI C±ê×¼ÒëÎÄÓë×¢½â
http://blog.csdn.net/huyansoft/archive/2008/05/26/2484297.aspx
<<ISO/ANSI C±ê×¼ÒëÎÄÓë×¢½â C/C++Ô¤´¦Àí²¿·Ö>>
ÄÚÈݼò½é£º±¾ÎĵµÍêÕû·ÒëÁËC±ê×¼(99°æ)ÖÐÔ¤´¦ÀíºÍÏà¹ØÕ½ڵÄÄÚÈÝ£¬²¢ÔÚÐí¶à±ØÒªÖ®´¦¸½¼ÓÁË×¢½âºÍ³ÌÐòʾÀý£¬ÒÔ°ïÖú¶ÁÕßÀí½â±ê×¼ÔÎÄ£¬Í¬Ê±ÖÆ×÷ÁËÏêϸµ ......
×Ô¼ºÐ´µÄC/C++±àÒëÆ÷Doctors[Èí¼þ+Îĵµ]
http://blog.csdn.net/huyansoft/archive/2009/08/20/4464772.aspx
¸üа汾1.0.1£º¸Ã°æ±¾½â¾öÁË֮ǰ1.0.0°æ±¾ÖÐÕÒ²»µ½Á´½Ó¿âlibc.libµÄÎÊÌ⣬ÒÔ¼°IDEϵã»÷Project²Ëµ¥³öÏÖµÄBUG¡£ÏÂÔØµØÖ·£ºhttp://download.csdn.net/source/1597132
Doctors±àÒëÆ÷ÄÚ²¿ÊµÏÖ
For version 1.0.1 ......
Ç¿ÖÆÀàÐÍת»»ÊÇͨ¹ýÀàÐÍת»»ÔËËãÀ´ÊµÏֵġ£ÆäÒ»°ãÐÎʽΪ£º (ÀàÐÍ˵Ã÷·û) (±í´ïʽ) Æä¹¦ÄÜÊǰѱí´ïʽµÄÔËËã½á¹ûÇ¿ÖÆ×ª»»³ÉÀàÐÍ˵Ã÷·ûËù±íʾµÄÀàÐÍ¡£ÀýÈ磺 (float) a °Ñaת»»ÎªÊµÐÍ(int)(x+y) °Ñx+yµÄ½á¹ûת»»ÎªÕûÐÍÔÚʹÓÃÇ¿ÖÆ×ª»»Ê±Ó¦×¢ÒâÒÔÏÂÎÊÌ⣺
1.ÀàÐÍ˵Ã÷·ûºÍ±í´ïʽ¶¼±ØÐë¼ÓÀ¨ºÅ(µ¥¸ö±äÁ¿¿ÉÒÔ²»¼ÓÀ¨ºÅ)£¬Èç°Ñ(int) ......
ת×Ô£ºhttp://dev.csdn.net/article/29/29329.shtm
¹ØÓÚÂß¼ÒÆÎ»¡¢ËãÊõÒÆÎ»¿É²Î¼û ѸÀ×Éî´ó±ÊÊÔÌⲿ·Ö¡£µÄÒ»µÀÌâ¡£
ÒÔǰ¿´µ½C++±ê×¼ÉÏ˵£¬ÒÆÎ»ÔËËã·û£¨<<¡¢>>£©³ö½çʱµÄÐÐΪ²¢²»È·¶¨£º
The behavior is undefined if the right operand is negative, or greater than or equal to the length in bit ......