Monday, 24 May 2021

Write a program in C to find the length of a string without using library function.

 Write a program in C to find the length of a string without using library function.









#include 
#include 
int main()
{
    char str[10];
    int length;

    printf("\nEnter the String : ");
    scanf("%s", str);

    length = 0;

    while (str[length] != '\0')
        length++;

    printf("\nLength of the String is : %d", length);
    return (0);
}


Output:



Share:

Related Posts:

0 comments:

Post a Comment