What is strstr() function in C ?

strstr( ) function in C is basically used in C program to find substring in given string.

What is strstr() function in C ?

Through this article we will try to cover whole basis queries about strstr( ) in detail so if you have any doubt related to this topic then you will be go with this article....

Topics:-

  1. strstr( ) function in c
  2. strstr( ) function in c example
  3. strstr( ) function in c syntax
  4. header file for strstr( ) function in c
  5. what does strstr( ) return ?

strstr( ) function in C

strstr( ) function is also known as a built in function or standard library function of C but it is widely know as string function. strstr( ) function is used to presence of substring in another in string.

Header file for strstr( ) function in C

strstr( ) function is a built in function of C and it is define in <string.h> header file.

Return Value of strstr( ) function in C

If the substring is not present in another string then strstr( ) function return NULL value.

Syntax of strstr( ) function in C

char *strstr(const char *arr1 , const char *arr2);

Example of strstr( ) function in C

#include<stdio.h>
#include<string.h>
int main()
{
  char n;
  char str[15]="AceinStudy";
  char str1[15]="Ace";
  n=strstr(str,str1);
  if(n)
  printf("str1 is present in str");
  else
  printf("str1 is Not present in str");
  return 0;
}

____________________________________

What is strstr() function in C ?
____________________________________

Conclusion:

strstr( ) function in C is basically used in C program to find substring in given string.

Post a Comment (0)
Previous Post Next Post