summaryrefslogtreecommitdiff
path: root/src/auxiliaryFunctions/find/dfinda.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auxiliaryFunctions/find/dfinda.c')
-rw-r--r--src/auxiliaryFunctions/find/dfinda.c11
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;
}