I think there is a bug here: ``` sample[c][0] = -1.0; for(i=1;i<=inputs;i++) scanf("%lf", &sample[c][i]); ``` since you started i=1, then scanf should use ("%lf", &sample[c][**i-1**]). Otherwise the last item will be read unknown memory space.