Length of a given string – C Program

Write a C program to find the string length of a given string.
Note : Should not use the “strlen( )” function. [Dec 2015, Set-4]

#include <stdio.h>

int main()
    char str[80];
    int l;

    printf("Enter a string: ");

    /* Find the length of the string */
    for (l = 0; str[l] != '\0'; l++);

    /* Display the length of string */
    printf("The length of string is: %d", l);

    return 0;