Reputation: 11
I have the following function written in c and working properly; but I need to convert it to c#. There is variable called unsigned int found_at = -1 ; the equivalent in c# should be uint found_at = -1; However I receive compiler error. Could you please guide me to solve this problem
unsigned int find_adjacent_values(double val, unsigned int start_here, unsigned int end_here, double *vector) {
unsigned int i = start_here, found = 0, found_at = -1;
while (i < end_here-1 && found == 0) {
if (val >= vector[i] && val < vector[i+1]) { // check whether we found adjacent values
found = 1;
found_at = i;
} else {
i += 1;
}
}
return found_at;
}
Upvotes: 0
Views: 945