Quote Originally Posted by Malcolm McLean View Post
Use this interface

void zeroCrossings(const float *x, bool *crossings, int N);

The array crossings is the same length as the input array x, but each position represents the line between adjacent positions in x (so it would be one less were it not for the special rule about array end).

Now you iterate through it. Basically you just set the flag every time you get a sign change, but you need to handle zeros specially, and you need a special case for the last value.

If you need output as a list of integers rather than flags, wrap this function with a simple data reformatting function - that makes it easier for you.
Thanks for your reply, I already solved the compilation error, and now I have wrong output.
Appreciated for any help/suggestion.