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.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/auxiliaryFunctions/find/dfinda.c b/src/auxiliaryFunctions/find/dfinda.c
index efbda20e..2aa5f7fe 100644
--- a/src/auxiliaryFunctions/find/dfinda.c
+++ b/src/auxiliaryFunctions/find/dfinda.c
@@ -10,19 +10,17 @@
*
*/
+
#include "find.h"
-double *dfinda(double* x, int size) {
+void dfinda(double* x, int size ,double *out, int *indiceOut) {
int i = 0;
- int indiceOut = 0;
- double* out=NULL;
+ *indiceOut = 0;
for (i = 0; i < size ; ++i) {
if (x[i] != 0) {
- out = realloc(out, (uint)(indiceOut+1)*sizeof(double));
- out[indiceOut] = (double)i;
- indiceOut++;
+ out[*indiceOut] = (double)(i + 1);
+ (*indiceOut)++;
}
}
- return out;
}