0% found this document useful (0 votes)
8 views

String Function Version1

The document discusses string functions in C. Some key string functions are: - strcat and strncat concatenate/append strings - strcpy and strncpy copy strings - strlen returns the length of a string - strcmp and strcmpi compare strings - strchr and strrchr find the first/last occurrence of a character in a string - strstr finds the occurrence of a substring - strdup duplicates a string - strlwr and strupr convert a string to lowercase/uppercase - strrev reverses a string

Uploaded by

jayceelunaria7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

String Function Version1

The document discusses string functions in C. Some key string functions are: - strcat and strncat concatenate/append strings - strcpy and strncpy copy strings - strlen returns the length of a string - strcmp and strcmpi compare strings - strchr and strrchr find the first/last occurrence of a character in a string - strstr finds the occurrence of a substring - strdup duplicates a string - strlwr and strupr convert a string to lowercase/uppercase - strrev reverses a string

Uploaded by

jayceelunaria7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

SVNTAYKPPQFIKPEBALHZMDSQKDOMK

XRXGLZQVGXMWFZRIUZQZFHEGONGOB
TXNDZLZPGDJBRHDAVYDZOXVKKBRVSD
YAOQWVASYUWWBKNEXOFBWDDRVXF
SBUVZINZMUEEXAQGPFUJSDZGMNILAT
FLVARVQQDIEENEJCRZYWOFXHFLYXCPS
HJKAHDGGEZFZJZCIFOQOTBBOBTVIRJXR
NSBTZABPDEIVBLVOCGHZEBXBOOXCBTZ
ABPDEFTYKLK
STRING FUNCTION
STRING FUNCTION
A string in C is merely an array of characters. The length of a string is
determined by a terminating null character: '\0'. So, a string with the
contents, say, "abc" has four characters: 'a', 'b', 'c', and the terminating
null ('\0') character.
Because programmers find raw strings cumbersome to deal with, they
wrote the code in the <string.h> library. It represents not a concerted
design effort but rather the accretion of contributions made by various
authors over a span of years.
STRING FUNCTION
gets(), puts() – string functions to take string input from the user and
display it respectively
STRING FUNCTION
strcat – concatenates/appends source to target
strcat(target, source)
STRING FUNCTION
strncat – concatenates/appends a portion of source to target
strncat(target, source, length)
STRING FUNCTION
strcpy – copies source to target
strcpy(target, source)
STRING FUNCTION
strncpy – copies a given number of characters from source to target
strncpy(target, source, length)
STRING FUNCTION
strlen – gives the length of a given string and returns an integer
strlen(string)
STRING FUNCTION
strcmp – compares two given string
strcmp(string1, string2)

STRING A

STRING B
STRING FUNCTION
strcmpi – compares two given string but not case sensitive
strcmpi(string1, string2)
STRING FUNCTION
strchr – returns pointer to first occurrence of char in string1
strchr(string1, char)
STRING FUNCTION
strrchr – the last occurance of given character in a string is found
strrchr(string1, char)
STRING FUNCTION
strstr – the last occurrence of a given character in a string is found
strstr(string1, string2)
STRING FUNCTION
strdup – duplicates the string
strdup(string)
STRING FUNCTION
strlwr – converts string to lowercase
strlwr(string)
strupr – converts string to uppercase
strupr(string)
STRING FUNCTION
strrev – reverses the given string
strrev(string)
STRING FUNCTION
strset – sets all character in a string to a given character
strset(string, char)
STRING FUNCTION
strnset – sets all character in a string to a given character
strnset(string, char, length)
STRING FUNCTION
strtok – tokenizes the given string using delimiter
strtok(string, delimiter)

You might also like