Monday, May 2, 2016

String Length

Write a C Code That Calculate the length of given String .




#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

int main()
{
    char string[30];
    int i , length=0;

    printf("Please Enter a String :\n");
    gets(string);

    for(i=0;string[i] != '\0';i++){
        length++;
    }
    printf("The Length of The Entered string is %d\n",length);
}



Share this

0 Comment to "String Length"

Post a Comment