In the last tutorial I gave a brief introduction of the relation between strings and pointers. I also told you about the 2D array of characters. Today I will tell you about some commonly used standard library string functions. These functions are made by the compiler vendors to speed up the manipulation of strings in C programming. So lets get started.
Standard Library String Functions
There are more than 18 standard library string function but only 4 of them are used very frequently. So I will only discuss those 4 functions which are strlen(), strcpy(), strcat(), strcmp().
Note: The header file that we will use for these functions is string.h.
strlen() in C
As its name suggest, this function is made to calculate the length of the string. By using this function we can calculate the number of characters in any string.
printf("Lenth of first string %dnLength of second string %d",x,y);
Here you can see I have calculated the length of the string by two ways. So you can either pass string or string variable. Remember while calculating the length it doesn’t count ‘