Advertisement
extrica

Untitled

Feb 2nd, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. int IzbaciPodniz (int *p1, int *p2, const int *q1, const int *q2)
  2. {
  3.  
  4. int broj_el2 = q2-q1;
  5. int brojac_podnizova=0;
  6. int *pom1=p1;
  7. const int *pom2=q1;
  8. int *za_izbacivanje;
  9.  
  10.  
  11. while(pom1<p2) {
  12.  
  13. if(*pom1==*q1) {
  14.  
  15. za_izbacivanje=pom1;
  16.  
  17. while(pom2<q2) {
  18.  
  19. if(*pom1==*pom2) {
  20.  
  21. pom1++;
  22. pom2++;
  23.  
  24. }else if(*pom1 != *pom2 && q2-pom2 != 0) {
  25.  
  26. pom2=q1;
  27. pom1--;
  28. break;
  29. }
  30. }
  31.  
  32. if(q2-pom2==0) {
  33.  
  34. brojac_podnizova++;
  35.  
  36. while(pom1 < p2) {
  37.  
  38. *za_izbacivanje=*pom1;
  39. za_izbacivanje++;
  40. pom1++;
  41. }
  42.  
  43. pom1=p1-1;
  44. pom2=q1;
  45. p2 = p2-broj_el2;
  46. }
  47. }
  48.  
  49. pom1++;
  50. }
  51.  
  52. return brojac_podnizova*broj_el2;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement