If we want to calculate number of characters in a string then it can be done with the help of a function strlen(). This function takes a string as argument and then return the number of characters in string.
As we know that index of array always starts with 0 and every character string contains a NULL character ('\0') . So this function counts the indices of string until it gets the NULL character.
Check this program-