diff options
Diffstat (limited to 'src/auxiliaryFunctions/find/sfinda.c')
-rw-r--r-- | src/auxiliaryFunctions/find/sfinda.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/auxiliaryFunctions/find/sfinda.c b/src/auxiliaryFunctions/find/sfinda.c index f038c9c9..74fd3cf8 100644 --- a/src/auxiliaryFunctions/find/sfinda.c +++ b/src/auxiliaryFunctions/find/sfinda.c @@ -12,13 +12,18 @@ #include "find.h" -int sfinda(float* x, int size) { +float* sfinda(float* x, int size) { int i = 0; + int indiceOut = 0; + float* out=NULL; + for (i = 0; i < size ; ++i) { if (x[i] != 0) { - return i; + out = realloc(out, (uint)(indiceOut+1)*sizeof(float)); + out[indiceOut] = (float)i; + indiceOut++; } } - return NOT_FOUND; + return out; } |