C programming string.h header


The C header <string.h> declare many string manipulation functions.If you want to copy a string from one array to another or get the string length or isolate a specific character sequence from the string and many more,declare the string.h header and call the appropriate functions.It also declare one type and one macro.The type,macro and functions declared by this header are given below.

Type

size_tThis type is same as unsigned int.

Macro

NULLThis is the character value of the integer 255.

Member functions

Function nameFunction definition
Copying function
memcpyCopies string from one array to another
memmoveCopies string from one array to another
strcpyCopies string from one array to another
strncpyCopies a specific number of characters from one array to another
Concatenation
strcatConcatenate two strings
strncatConcatenate specific number of characters
Comparison function
memcmpCompares specific number of characters of two strings
strcmpCompares two string
strcollCompare two string base on the locale
strncmpCompares specific number of characters.
strxfrmTransform the string.
Search function
memchrLocate the first occurrence of a specific character in a first ‘n’ character ofstring
strchrLocate the first occurrence of a character in string
strcspnCompute the segment without any character of another string
strpbrkLocate the first occurrence of any of a string in another string
strrchrLocate the last occurrence of character in a string
strspnCompute the length of the intial segment entirely of the characters of another string
strstrLocate the first occurrence of a any character of a string in another string
strtokisolate certain segment of sequence of character of a string using a delimiter character
Miscellaneous function
memsetSet the memory block with a value
strlenCompute the length of the string
strerrorPrints the error associated with the function