Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c strstr

// CPP program to illustrate strstr()
#include <string.h>
#include <stdio.h>
  
int main()
{
    // Take any two strings
    char s1[] = "GeeksforGeeks";
    char s2[] = "for";
    char* p;
  
    // Find first occurrence of s2 in s1
    p = strstr(s1, s2);
  
    // Prints the result
    if (p) {
        printf("String found
");
        printf("First occurrence of string '%s' in '%s' is '%s'", s2, s1, p);
    } else
        printf("String not found
");
  
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #strstr
ADD COMMENT
Topic
Name
9+1 =