[ create a new paste ] login | about

Link: http://codepad.org/Ycq4rQ4L    [ raw code | output | fork ]

slevy1ster - C, pasted on Mar 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <string.h>
int mystrCmp(const char * a, const char * b);

int mystrCmp(const char * a, const char * b){
for(; *a == *b; ++a, ++b)
        if(*a == 0)
            return 0;
 return *(const char *)a - *(const char *)b;
}

int main(void) {
char *s1 = "1252";
char *s2 = "1252";
int res = mystrCmp(s1,s2);
printf("\nResult is %d",res);
return 0;
}


Output:
1
2

Result is 0


Create a new paste based on this one


Comments: