Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int strdiff(char *a, char *b){
- int index = 0;
- while(a[index] != '\0' && b[index] != '\0' && a[index] == b[index]){
- index++;
- }
- if(a[index] == '\0' && b[index] == '\0'){
- return -1;
- }
- char val = a[index]^b[index];
- int i = 0;
- while(val){
- if(val&1){
- return 8*index+i;
- }
- val = val >> 1;
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement