Answer:
String operations (string.h)
C language recognizes that string is a different class of array by letting us input and output the array as a unit and are terminated by null character. C library supports a large number of string handling functions that can be used to array out many of the string manipulations such as:
strlen() function
This function counts and returns the number of characters in a strings. The length does not include a null character.
Syntax:
n=strlen (string);
Where n is integer variable. Which receives the value of length of the string.
strcat() function
When we combine two strings, we add the characters of one string to the end of other string. This process is called concatenation. The strcat() function joins 2 strings together. It takes the following form:
Syntax:
strcat(string ,string2);
string1 & string2 are character arrays. When the function strcat is executed string2 is appended to string 1. The string at string2 remains unchanged.
Strrev() function
The string.h header file contains function to reverse the characters in a string. The function is
strrev(). This function simply reverses all the characters in the given string. The general format of strrev() function is.
Syntax:
strrev(string-variable);
where string-variable is any character array variable or string constant.
Strcmp() Function
In C we cannot directly compare the value of 2 strings in a condition like if(string1 ==string2) Most libraries how ever contain the strcmp() function, which returns a zero if 2 strings are equal, or a non zero number if the strings are not the same. The syntax of strcmp() is given below:
Syntax:
strcmp(stringl,string2)
String1 & string2 may be string variables or string constants. String1 & string2 may be string variables or string constants some computers return a negative, if the stringl is alphabetically less than the second and a positive number if the string is greater than the second.