Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. int main()
  2. {
  3. const int size = 20;
  4. char str1[size] = "avadakedavra";
  5. char str2[size] = "abvdea";
  6. printf("number:%d", str_cmp( str1, str2));
  7. }
  8. int str_cmp(char* str1, char* str2)
  9. {
  10. int i = 0;
  11. int j = 0;
  12.  
  13. int count = 0;
  14. while (str1[i])
  15. {
  16. /*while (str2[j])
  17. {*/
  18. if (str1[i] - str2[j] == 0)
  19. {
  20. count++;
  21. i++;
  22. j = 0;
  23.  
  24. }
  25. else
  26. {
  27. if (str2[j + 1])
  28. {
  29. j++;
  30. }
  31. else
  32. { i++;
  33. j = 0;
  34. }
  35.  
  36. }
  37. /*if (str1[i] && str2[j] && delta = 0)
  38. {
  39. str1[i] - str2[j] = 0;
  40. count++;
  41. }*/
  42. /*}*/
  43.  
  44. }
  45. return count;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement