📜  如何计算数组中的字符数 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:44.044000             🧑  作者: Mango

代码示例1
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;
}