diff options
author | torset | 2009-01-09 13:02:41 +0000 |
---|---|---|
committer | torset | 2009-01-09 13:02:41 +0000 |
commit | 5990ef5e5762976752eac62959b844dc4e9ec004 (patch) | |
tree | a1084761fdc6246bcfe05c3c43eacedb87d661fe /src/auxiliaryFunctions/find/dfinda.c | |
parent | 27d1195037550a3e3a99769c1d39e5f2f122616c (diff) | |
download | scilab2c-5990ef5e5762976752eac62959b844dc4e9ec004.tar.gz scilab2c-5990ef5e5762976752eac62959b844dc4e9ec004.tar.bz2 scilab2c-5990ef5e5762976752eac62959b844dc4e9ec004.zip |
Change find prototype and function (output is one dimention indexation)
Diffstat (limited to 'src/auxiliaryFunctions/find/dfinda.c')
-rw-r--r-- | src/auxiliaryFunctions/find/dfinda.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/auxiliaryFunctions/find/dfinda.c b/src/auxiliaryFunctions/find/dfinda.c index b347d771..efbda20e 100644 --- a/src/auxiliaryFunctions/find/dfinda.c +++ b/src/auxiliaryFunctions/find/dfinda.c @@ -12,12 +12,17 @@ #include "find.h" -int dfinda(double* x, int size) { +double *dfinda(double* x, int size) { int i = 0; + int indiceOut = 0; + double* out=NULL; + for (i = 0; i < size ; ++i) { if (x[i] != 0) { - return i; + out = realloc(out, (uint)(indiceOut+1)*sizeof(double)); + out[indiceOut] = (double)i; + indiceOut++; } } - return NOT_FOUND; + return out; } |