How to use the strstr() function to return a pointer to the first occurrence of s2[] in s1[] in C

1 Answer

0 votes
#include <stdio.h>
#include <string.h>
 
int main(void)
{
	char s[] = "The C programming language";
	char *p;
  
	p = strstr(s, "programming");
	puts(p);
     
    return 0;
}

 
/* 
run:

programming language

*/

 



answered Feb 16, 2016 by avibootz
...