P165. Program to length of a string using recursive function.
#include<stdio.h>
int
len(char *);
void
main()
{
char a[10]="Garud";
printf("Length = %d",len(a));
printf("\n");
}
int
len(char *p)
{
static int i=0;
if(*p)
{
i++;
len(p+1);
return i;
}
else
return 0;
}
Comments
Post a Comment