Program to find length of a string using user defined function


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

void length(char *);
main()
{
char str[25];
clrscr();

printf(" enter the string\n");
gets(str);
length(str);

getch();
}

void length(char *x)
{
 for(int i=0;x[i]!='\0';i++);
 printf("\n length of the string is %d",i);
}




0 comments:

Post a Comment