Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

C string (string.h) Library


C string Functions

The <string.h> library has many functions that allow you to perform tasks on strings.

A list of all string functions can be found in the table below:

Function Description
memchr() Returns a pointer to the first occurrence of a value in a block of memory
memcmp() Compares two blocks of memory to determine which one represents a larger numeric value
memcpy() Copies data from one block of memory to another
memmove() Copies data from one block of memory to another accounting for the possibility that the blocks of memory overlap
memset() Sets all of the bytes in a block of memory to the same value
strcat() Appends one string to the end of another
strchr() Returns a pointer to the first occurrence of a character in a string
strcmp() Compares the ASCII values of characters in two strings to determine which string has a higher value
strcoll() Compares the locale-based values of characters in two strings to determine which string has a higher value
strcpy() Copies the characters of a string into the memory of another string
strcspn() Returns the length of a string up to the first occurrence of one of the specified characters
strerror() Returns a string describing the meaning of an error code
strlen() Return the length of a string
strncat() Appends a number of characters from a string to the end of another string
strncmp() Compares the ASCII values of a specified number of characters in two strings to determine which string has a higher value
strncpy() Copies a number of characters from one string into the memory of another string
strpbrk() Returns a pointer to the first position in a string which contains one of the specified characters
strrchr() Returns a pointer to the last occurrence of a character in a string
strspn() Returns the length of a string up to the first character which is not one of the specified characters
strstr() Returns a pointer to the first occurrence of a string in another string
strtok() Splits a string into pieces using delimiters
strxfrm() Convert characters in a string from ASCII encoding to the encoding of the current locale

Related Pages

C Strings Tutorial



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.