Finding the length of a String in C

PHOTO EMBED

Tue Apr 18 2023 10:48:18 GMT+0000 (Coordinated Universal Time)

Saved by @fridah #c

#include <stdio.h>

/**
 * _strlen-calculates the length of a string
 * @str: the string
 * Return: returns the length of the string
 */

int _strlen(char *str)
{
    int i, len;

    len = 0;
    for (i = 0; str[i]; i++)
    {
        len++;
    }
    return (len);
}
content_copyCOPY

Finding the length of a String in C