/*WAP that look-alike of the function strlen( ) */
#include<stdio.h>
#include<conio.h>
main( )
{
char arr[ ] = "codezworld" ;
int len1, len2 ;
len1 = xstrlen ( arr ) ;
len2 = xstrlen ( "A blog of programs" ) ;
printf ( "\nstring = %s length = %d", arr, len1 ) ;
printf ( "\nstring = %s length = %d", "A blog of programs", len2 ) ;
}
xstrlen ( char *s )
{
int length = 0 ;
while ( *s != '\0' )
{
length++ ;
s++ ;
}
return ( length ) ;
}



No comments:
Post a Comment