C String Length - C Program to Find the Length of a String



 c program to find the length of a string

Learn C - C tutorial - c program to find the length of a string - C examples - C programs

C Program to Find the Length of a String

  • This program prints length of a string. For example, length of the string "wikitechy.com" is 13 .

Sample Code

#include <stdio.h>
int main()
{
    char s[1000]="Wikitechy", i;
    printf("String:Wikitechy \n");
    for(i = 0; s[i] != '\0'; ++i);
    printf("Length of string: %d", i);
    return 0;
}

Output

String:Wikitechy 
Length of string: 9


View More Quick Examples


Related Searches to C String Length - C Program to Find the Length of a String