STRING LENGTH WITHOUT USING LIBRARY FUNCTION - C-Tutorial

Latest

Monday, 26 September 2016

STRING LENGTH WITHOUT USING LIBRARY FUNCTION

/* STRING LENGTH WITHOUT USING LIBRARY FUNCTION */


#include<stdio.h>
#include<conio.h>
main()
{
char str[30];
int i,count=0;
clrscr();
printf("\n Enter a string: ");
gets(str);
for(i=0; str[i]!='\0'; i++)
{
count=count+1;
}
printf("\n The given string length is = %d",count);
getch();
}

No comments:

Post a Comment