Encoders
>
More...
>
C
>
Program
/* Function strcmp(s,t) to return the difference of the characters at the
first position where s and t disagree. (using pointers) */
#include <stdio.h>
int strcmp(char *s, char *t);
main()
{
printf("%d\n",strcmp("apple","application"));
}
int strcmp(char *s, char *t)
{
for(; *s==*t && (*s || *t); s++,t++)
;
return *s - *t;
}
|