Answers for "how to count number of characters in an array"

0

how to count number of characters in an array

int countChars(char *array[], int len)
{
    int total = 0, count = 0;


    for (int i = 0; i < len; i++)
    {
        if (array[i] != NULL)
        {
            while (*array[i] != '\0') {
                count++;
            }
            count++;
        }
        total += count;
    }

    return total;
}
Posted by: Guest on February-11-2020

Code answers related to "how to count number of characters in an array"

Browse Popular Code Answers by Language