strstr() function (sub-string) in C.

 

01  #include<stdio.h>
02 #include<string.h>
03
04 int main()
05 {
06 char *str = "International company", *sub = "nation", *ptr;
07
08 ptr = strstr(str, sub);
09 printf("The substring is: %sn", ptr);
10
11 return 0;
12 }
 
 OUTPUT :

The substring is : national company

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *