I have two arrays of pointers. I need to do simple arithmetic with them while going in loop
float **x_points, **y_points;
x_points = malloc(sizeof(float*) * n);
y_points = malloc(sizeof(float*) * n);
for( i = 0; i < n; i++) {
printf("x");
printf("%i",i);
printf(" : ");
x_points[i] = malloc( n * sizeof ( float ) );
scanf("%f",x_points[i]);
printf("y");
printf("%i",i);
printf(" : ");
y_points[i] = malloc( n * sizeof ( float ) );
scanf("%f",y_points[i]);
}
x_points[n] = NULL;
y_points[n] = NULL;
And here I have problems:
int k;
for(k=0; k < i; k++) {
R += *x_points[k] * *y_points[k+1] - *x_points[k+1] * *y_points[k];
}
Couldn't you tell me why does this code shows me a window says that the system got a signal and that's why stopped the program? THank you, I will appreciate it!