Library functions of string.h header file in C

All library function of string.h header file is given bellow. These functions are related to sting in C.

  • strcat() — strcat() function is defined inside string.h and used to concatenate second string after first string.
  • strncat() — strncat() function is used to concatenate n characters of second string after first string.
  • strcmp() — strcmp() function can compare two string.
  • strncmp() — strncmp() function is used to compare first n characters of two string.
  • strcpy() — strcpy() which is declared under string.h header file and this function copies second string to the first string.
  • strncpy() — strncpy() function is used to copy n characters of second string to first string.
  • strlen() — strlen() function can calculate the length of given string.
  • strchr() — strchr() function returns the pointer of first occurrence of character in first string.
  • strrchr() — strrchr() function gives the last occurrence of a given character.
  • strstr() — strstr() gives pointer to the first occurrence of second string to first string.
  • strrstr() — strrstr() returns the pointer to the last occurrence of second string to first string.
  • strlwr() — strlwr() function can convert all the character of any string to lowercase.
  • strupr() — strupr() string function converts all characters of string to uppercase.
  • strdup() — strdup() can duplicate any string.
  • strrev() — strrev() is also defined inside string.h and is used to get reverse string from given string.
  • strset() — strset() function sets all characters of a string to the given character.
  • strnset() — strnset() function is used to set n characters of a string to the given character.
  • strspn() — strspn() function is used to determine the initial length of a string, containing the only characters of the other string.
  • strcspn() — strcspn() function is used to calculate initial length of a string, not containing any character of the other string.
  • strtok() — strtok() function is used to split a string into token.

Previous pagemath.h header file

Next pagectype.h header file