I have this code but is not working , it keep giving me the following errors :
[Error] cannot convert 'float' to 'float*' for argument '1' to 'void zeroCrossing(float*, float*, int)'
[Error] cannot convert 'float*' to 'float' for argument '1' to 'bool getSign(float)'
[Error] cannot convert 'float*' to 'float' for argument '1' to 'bool getSign(float)'
[Error] invalid conversion from 'int' to 'float*' [-fpermissive]
enter code here
#include <iostream>
#include <cstring>
using namespace std;
2) Your getSign function takes a single float as an argument. You've defined data as array of float*, which means that data[i] is a float*.
So, you're trying to pass a float*, where your function expects a float.
3) Similarly, zerCross is an array of float*. This means zerCross[i+1] is a float*. You're trying to set a pointer, to have a value of 1, which is an int.
[Error] cannot convert 'float' to 'float*' for argument '1' to 'void zeroCrossing(float*, float*, int)'
This usually means you're passing a variable, where the address a variable is expected.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
void zeroCrossing(float *data, float *zerCross, int nx);
int main()
{
float array[9] = {1,2,3,0,-1,-2,-3,0,1};
float *p = array;
float f1[9];
float *p2 = f1;
int bx= 2 ;
zeroCrossing(*p,*p2,bx); // kbw: *p is a float, it expects a float*, same with *p2
zeroCrossing(array, f1, bx); // kbw: this is probably what you should be doing
}