Pointer Example
/*
* Get the length of a string
*/
int strlen(char * s)
{
register int i = 0;
while (s[i] != '\0') i++;
return(i);
}
/*
* Copy src to dest
*/
void strcpy(char * dest, char * src)
{
while('\0' != (*dest++ = *src++)) ;
}
/*
* append to the string dest
*/
void strcat(char * dest, char * add)
{
while('\0' != *left) left++;
while('\0' != (*left++ = *right++));
}
/*
* Compare two strings.
* return < 0 if s0 if s>t
*/
int strcmp(char *s, char *t)
{
while((*s == *t) && (*s != '\0')) s++, t++;
return(*s - *t);
}