C Reference String Operation: strstr()

The function strstr() returns a pointer to the first occurrence of x in a string.
It is also know as searching for a sub-string in a string.

Usage:

char * strstr ( const char *, const char * );
char * strstr ( char * str1, const char * str2 );

Return Value

A pointer to the first occurrence in str1 of any of the entire sequence of characters specified in str2. If nothing is found a null pointer is returned if the sequence is not present in str1.
More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strstr()


C Reference String Operation: strrchr()

The function strrchr() returns a pointer to the last occurrence of x in a string.

Usage:

char *strrchr( const *str, int x);

Note: NULL will be returned if x isn’t found. More »


Posted in C Reference string.h Functions | 2 Comments


C Reference String Operation: strncpy()

The function strncpy() copies up to n characters of one string to another string.

Usage:

char * strncpy( char * target, const char *source, size_t count); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strncpy()


C Reference String Operation: strncmp()

The function strncmp() compares one string with another string up-to n characters.

Usage:

int strncmp( const char * target, const char * source, size_t count); More »


Posted in C Reference string.h Functions | 2 Comments


C Reference String Operation: strncat()

The strncat() function concatenates up to n characters of one string onto the end of another string.

Usage:

char *strncat(char *target, const char * source, size_t count); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strncat()


C Reference String Operation: strlen()

The strlen() function returns the length of a string.

The length is determined by the number of characters before the null termination.

Usage:

size_t strlen(char *str)

strlen() source code example:

More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strlen()


C Reference String Operation: strcpy()

The function strcpy() copies the characters from one string to another string.

Note: the null termination is also copied.

Usage:

char * strcpy( char *target, const char *source); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strcpy()


C Reference String Operation: strcmp()

The function strcmp() compares one string with another string. The function strcmp() returns a integer value.

Usage:

int strcmp( const char * target, const char * source);

If the two strings are equal then zero is returned. More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strcmp()


C Reference String Operation: strchr()

The function strchr() returns a pointer to the first occurrence of x in a string.

Usage:

char *strchr( const *str, int x);

Note: NULL will be returned if x isn’t found.

strchr() source code example:

More »


Posted in C Reference string.h Functions | 1 Comment


C Reference String Operation: strcat()

The strcat() function concatenates up to n characters of one string onto the end of another string.

Usage:

char * strcat ( char * destination, const char * source ); More »


Posted in C Reference string.h Functions | Comments Off on C Reference String Operation: strcat()