string.h
Methods
Return | Method |
---|---|
void* |
memcpy( void *dest, const void *src, size_t n ) |
void* |
memmove( void *dest, const void *src, size_t n ) |
size_t |
strlen( const char *str ) |
int |
strcmp( const char *str1, const char *str2 ) |
char* |
strcpy( char *dest, const char *src ) |
char* |
strcat( char *dest, const char *src ) |
char* |
strrev( char *str ) |
Method Descriptions
void *memcpy( void *dest, const void *src, size_t n )
mem
ory c
opy
Copies n
bytes from src
to dest
. It is used to copy a block of memory from one location to another.
It does not check for overflow or \0
, and may cause problems when src
and dest
addresses overlap.
void *memmove( void *dest, const void *src, size_t n )
mem
ory move
Copies n
bytes from src
to dest
. It is used to copy a block of memory from one location to another.
It copies data first from src
to a buffer, then to dest
, so it is safe to use when src
and dest
addresses overlap.
size_t strlen( const char *str )
str
ing len
gth
Returns the length from a string str
up to but not including \0
.
int strcmp( const char *str1, const char *str2 )
str1
to string str2
per index starting with the first character, until the corresponding characters differ or end of one of the strings is reached.
Refer to ASCII table for reference
return value | condition |
---|---|
return < 0 |
str1 < str2 |
return == 0 |
str1 == str2 |
return > 0 |
str1 > str2 |
char *strcpy( char *dest, const char *src )
str
ing c
opy
Copies the string from src
to string pointer dest
, Includes \0
at the end of the string.
Returns string pointer dest
.
char *strcat( char *dest, const char *src )
str
ing concat
onate
Appends the string from src
to the end of dest
string.
Returns dest
string pointer.
char *strrev( char *str )
Reverses the string.