String Length
int strlen( char *s )
{
char *ptr = s;
while( *ptr++ );
return( ptr-s );
}
String Copy
char *strcpy( char *s, char *t )
{
char *ptr=s;
while( *s++ = *t++ );
return( ptr );
}
String Cat
char *strcat( char *s, char *t )
{
char *ptr=s;
while( *s++ );
while( *s++ = *t++ );
return( ptr );
}
String Compare
int strcmp( char *s, char *t )
{
int n;
while ((n = *s - *t++) == 0 && *s++);
return( n );
}
No comments:
Post a Comment