Tuesday, December 6, 2011

Write a C Program to find the length of any string without library function

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

void main ()
{    char ch[20];
    int l;
    clrscr();
    printf ("Enter String: ");
    gets(ch);
    for(l=0;ch[l]!='\0';l++);
    printf ("Length of string is %d",l);
    getch();
}

No comments:

Post a Comment