| 73 | return arr3; |
| 74 | } |
| 75 | struct Array* Difference(struct Array *arr1,struct Array |
| 76 | *arr2) |
| 77 | { |
| 78 | int i,j,k; |
| 79 | i=j=k=0; |
| 80 | |
| 81 | struct Array *arr3=(struct Array *)malloc(sizeof(struct |
| 82 | Array)); |
| 83 | |
| 84 | while(i<arr1->length && j<arr2->length) |
| 85 | { |
| 86 | if(arr1->A[i]<arr2->A[j]) |
| 87 | arr3->A[k++]=arr1->A[i++]; |
| 88 | else if(arr2->A[j]<arr1->A[i]) |
| 89 | j++; |
| 90 | else |
| 91 | { |
| 92 | i++; |
| 93 | j++; |
| 94 | } |
| 95 | } |
| 96 | for(;i<arr1->length;i++) |
| 97 | arr3->A[k++]=arr1->A[i]; |
| 98 | |
| 99 | |
| 100 | arr3->length=k; |
| 101 | arr3->size=10; |
| 102 | |
| 103 | return arr3; |
| 104 | } |
| 105 | int main() |
| 106 | { |
| 107 | struct Array arr1={{2,9,21,28,35},10,5}; |
nothing calls this directly
no outgoing calls
no test coverage detected