X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Ffunctions.c;fp=betty%2Ffunctions.c;h=cc03941f26a9dacb68581b63f061a50b1d6f3960;hp=43dfebc16b2856d2e81cd143520946720867e10c;hb=7f516b2153b747636e0b379882457ef3ea0ed23f;hpb=476b73692511eeed9602d71e773da5ab24831b74 diff --git a/betty/functions.c b/betty/functions.c index 43dfebc..cc03941 100644 --- a/betty/functions.c +++ b/betty/functions.c @@ -11,16 +11,20 @@ * functions */ -int strlen(char *string) { +#define modulo(d,x,y) (d)=(x); \ + while((d)>=(y)) \ + (d)-=(y); - int cnt; +int strlen(char *s) { - cnt=0; + int n; - while(string[cnt]) - cnt++; + n=0; - return cnt; + while(s[n]) + n++; + + return n; } int strncmp(char *a,char *b,int n) {