BEST SITE FOR WEB DEVELOPERS

C++ Tutorial

C++ HOME C++ Intro C++ Get Started C++ Syntax C++ Output C++ Comments C++ Variables C++ User Input C++ Data Types C++ Operators C++ Strings C++ Math C++ Booleans C++ Conditions C++ Switch C++ While Loop C++ For Loop C++ Break/Continue C++ Arrays C++ Structures C++ Enums C++ References C++ Pointers

C++ Functions

C++ Functions C++ Function Parameters C++ Function Overloading C++ Scope C++ Recursion

C++ Classes

C++ OOP C++ Classes/Objects C++ Class Methods C++ Constructors C++ Access Specifiers C++ Encapsulation C++ Inheritance C++ Polymorphism C++ Files C++ Exceptions C++ Date

C++ How To

Add Two Numbers Random Numbers

C++ Reference

C++ Reference C++ Keywords C++ <iostream> C++ <fstream> C++ <cmath> C++ <string> C++ <cstring> C++ <ctime>

C++ Examples

C++ Examples C++ Compiler C++ Exercises C++ Quiz C++ Certificate

C++ Language. W3Schools in English. Lessons for beginners

Ua Es De Fr

C++ cstring Library


C++ cstring Functions

The <cstring> library has many functions that allow you to perform tasks on arrays and C-style strings.

Note that C-style strings are different from regular strings in C++. A C-style string is an array of characters, created with the char type. To learn more about C-style strings, read our C Strings Tutorial.

A list of all cstring 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() Compare 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() Set all of the bytes in a block of memory to the same value
strcat() Appends one C-style string to the end of another
strchr() Returns a pointer to the first occurrence of a character in a C-style string
strcmp() Compares the ASCII values of characters in two C-style strings to determine which string has a higher value
strcoll() Compare the locale-based values of characters in two C-style strings to determine which string has a higher value
strcpy() Copy the characters of a C-style string into the memory of another string
strcspn() Returns the length of a C-style string up to the first occurrence of one of the specified characters
strerror() Returns a C-style string describing the meaning of an error code
strlen() Return the length of a C-style string
strncat() Appends a number of characters from a C-style string to the end of another string
strncmp() Compare the ASCII values of a specified number of characters in two C-style strings to determine which string has a higher value
strncpy() Copies a number of characters from one C-style string into the memory of another string
strpbrk() Returns a pointer to the first position in a C-style string which contains one of the specified characters
strrchr() Returns a pointer to the last occurrence of a character in a C-style string
strspn() Returns the length of a C-style string up to the first character which is not one of the specified characters
strstr() Returns a pointer to the first occurrence of a C-style string in another string
strtok() Splits a string into pieces using delimiters
strxfrm() Convert characters in a C-style string from ASCII encoding to the encoding of the current locale


Comments