C Standard Library
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

C - <string.h>

The C has a number of functions and macros that are available to work with C strings and arrays. These functions are available to use in a current program after including the header file using - #include <string.h>. All functions and macros of this header file are listed below:

Library Functions

Copy Functions

memcpy() Copy block of memory.
memmove() Move block of memory.
strcpy() Copy string.
strncpy() Copy characters from string.

Comparison Functions

memcmp() Compares two blocks of memory.
strcmp() Compares two strings.
strcoll() Compares two strings using locale.
strncmp() Compare characters of two strings.
strxfrm() Transform string using locale.

Concatenation Functions

strcat() Concatenate strings.
strncat() Append characters from string.

Searching Functions

memchr() Locate character in block of memory.
strchr() Searches the first occurrence of a character in a string.
strcspn() Get span until character in string.
strpbrk() Searches the first occurrence of any character of a string inside another string.
strrchr() Searches the last occurrence of a character in a string.
strspn() Get span of character set in string.
strstr() Searches the first occurrence of a string inside another string.
strtok() Split string into tokens.

Other Functions

memset() Fills a block of memory.
strlen() Returns the length of a byte string.

Library Macros

Macro constants

NULL Null pointer.

Library Types

size_t Unsigned integer type.