kevx:下面这个是微软VC++2005的C Runtime里面的代码,其实差不多。|@|/***|@|*strstr.c - search for one string inside another|@|*|@|* Copyright (c) Microsoft Corporation. All rights reserved.|@|*|@|*Purpose:|@|* defines strstr() - search for one string inside another|@|*|@|*******************************************************************************/|@||@|#include |@|#include |@||@|/***|@|*char *strstr(string1, string2) - search for string2 in string1|@|*|@|*Purpose:|@|* finds the first occurrence of string2 in string1|@|*|@|*Entry:|@|* char *string1 - string to search in|@|* char *string2 - string to search for|@|*|@|*Exit:|@|* returns a pointer to the first occurrence of string2 in|@|* string1, or NULL if string2 does not occur in string1|@|*|@|*Uses:|@|*|@|*Exceptions:|@|*|@|*******************************************************************************/|@||@|char * __cdecl strstr (|@| const char * str1,|@| const char * str2|@| )|@|{|@| char *cp = (char *) str1;|@| char *s1, *s2;|@||@| if ( !*str2 )|@| return((char *)str1);|@||@| while (*cp)|@| {|@| s1 = cp;|@| s2 = (char *) str2;|@||@| while ( *s1 && *s2 && !(*s1-*s2) )|@| s1++, s2++;|@||@| if (!*s2)|@| return(cp);|@||@| cp++;|@| }|@||@| return(NULL);|@||@|}
devc支持c99吗_Dev C++中C语言不支持For(int i=0;;)的声明
最新推荐文章于 2023-06-27 09:26:02 发布