I have a C code and wanna save data x and y but only I get a zero values into this pointer array
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
//Ingreso el numero de puntos
printf("Numeros de puntos: ");
scanf("%i", &n);
//Asignacion de memoria para los puntos x y y
double *x= (double*) calloc(n,sizeof(*x));
double *y= (double*) calloc(n,sizeof(*y));
//Ingreso de datos
printf("Ingrese los puntos x,y: ");
for(int i = 0 ; i < n ; i++){
scanf("%d", &x[i]);
scanf("%d", &y[i]);
}
for(int j = 0 ; j < n ; j++){
printf("\n%.3f, %.3f", *(x+j),*(y+j));
}
//Libero memoria de x y y
free(x);
free(y);
return 0;
}
When I print anything with n numbers I get this n output (number of points equals 2)
0.000, 0.000
0.000, 0.000