C Tutorial/string.h/strstr — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 13:32, 25 мая 2010

strstr

Item Value Header file string.h Declaration char *strstr(const char *str1, const char *str2); Function Returns a pointer to the first occurrence of *str2 in *str1 or a null pointer if there str2 is not part of str1. Return It returns a null pointer if no match is found.


<source lang="cpp">#include <string.h>

 #include <stdio.h>
 int main(void)
 {
   char *p;
   p = strstr("this is a test", "is");
   printf(p);
   return 0;
 }</source>