I have defined a dynamic array this way:
double *n_data ;
int n_data_c = 0, n_cnt = 0;
n_data_c = count_lines_of_file("abnorm");
n_data = (double *)malloc(n_data_c * sizeof(double));
in a loop I calculate distance and do so:
n_cnt++;
n_data[n_cnt] = distance;
but it returns segmentation fault
here : n_data[n_cnt] = distance;
I want to know if I'm doing something wrong.