This is simple C Program which prints out the length of a string without using the string function strlen().
OUTPUT :
PROGRAM :
#include <stdio.h>
#include <stdlib.h>
int main()
{
char name[20];
int i,length=0;
printf("Enter any name(String) : \t");
gets(name);
for(i=0; name[i]!='\0'; i++)
length++;
printf("\nThe length of the string is \t %d \n",i);
return 0;
}OUTPUT :
| C Program to find length of a string without using strlen() |
No comments:
Post a Comment