66. WRITE A C PROGRAM TO FIND LENGTH OF STRING WITHOUT USING LIBRARY FUNCTION

/*C program to Find Length of String Without using Library Function*/

#include<stdio.h>
int main() {
char str[100];
int length;
printf("\nEnter the String : ");
gets(str);
length = 0; // Initial Length
while (str[length] != '\0')
length++;
printf("\nLength of the String is : %d", length);
return(0);
}

output

enter the string
kucet
the length of the string is : 5

Comments