I have a programming problem I'm unsure how to solve.
I have two arrays and a function. The function works on array1 on a given range. Array2 contains ranges in array1 that are forbidden to be worked on.
@ceo_of_monoeye_dating I'm working in C.
The array structure is meaningful so I can't touch either of the arrays.
@johnbudd1350 I want to call the function (the function has 3 arguments, start and end index, and array1) on black parts individually, but the start and end of the red parts is in a different array.
@johnbudd1350 I'm not given a list of ranges. I only know length of array1.
@johnbudd1350 Yeah
@johnbudd1350 Thanks, but how to do it when a range in array2 starts at 0 or ends at end of array1?
If it doesn't you first need to call the function before looping through array2, but you don't know where to end before looping through array2.
I think I might need to make a new array with the acceptable ranges and just loop through that.
@Corfiot @johnbudd1350 I can create anything I want. Just can't touch the arrays.
You can mask off the values in array1 before calling the function, and that's my first guess.
If your function operates element-wise, you can check each element of array1 for not being in array2 right before you pass each element to the function. This won't work if the array structure is meaningful as anything other than a container for your elements, though.