x

C – string.h library functions

Prev     Next

C string.h library functions:


All C inbuilt functions which are declared in string.h header file are given below. The source code for string.h header file is also given below for your reference.


List of inbuilt C functions in string.h file:

String functions
Description
strcat ( ) Concatenates str2 at the end of str1
strncat ( ) Appends a portion of string to another
strcpy ( ) Copies str2 into str1
strncpy ( ) Copies given number of characters of one string to another
strlen ( ) Gives the length of str1
strcmp ( ) Returns 0 if str1 is same as str2. Returns <0 if strl < str2. Returns >0 if str1 > str2
strcmpi ( ) Same as strcmp() function. But, this function negotiates case.  “A” and “a” are treated as same.
strchr ( ) Returns pointer to first occurrence of char in str1
strrchr ( ) last occurrence of given character in a string is found
strstr ( ) Returns pointer to first occurrence of str2 in str1
strrstr ( ) Returns pointer to last occurrence of str2 in str1
strdup ( ) Duplicates the string
strlwr ( ) Converts string to lowercase
strupr ( ) Converts string to uppercase
strrev ( ) Reverses the given string
strset ( ) Sets all character in a string to given character
strnset ( ) It sets the portion of characters in a string to given character
strtok ( ) Tokenizing given string using delimiter
string functions
Description
memset() It is used to initialize a specified number of bytes to null or any other value in the buffer
memcpy() It is used to copy a specified number of bytes from one memory to another
memmove() It is used to copy a specified number of bytes from one memory to another or to overlap on same memory.
memcmp() It is used to compare specified number of characters from two buffers
memicmp() It is used to compare specified number of characters from two buffers  regardless of the case of the characters
memchr() It is used to locate the first occurrence of the character in the specified string

Source code for string.h header file:

Please find the source code for string.h header file below. This code is taken from DevC++ compiler files for your reference.

Prev     Next



Like it? Please Spread the word!