Write a C Program to find the length of a string without using the built – in function.

#include<stdio.h>
#include<conio.h>
void main()
{
   char a[12];
   int i,length=0;
   clrscr();
   printf("\nEnter a string");
   scanf("%s",&a);
   for(i=0;a[i]!='\0';i++)
   length++;
   printf("\nNumber of character in the string is %d",length);
   getch();
}

No comments:

Post a Comment