I am learning how to create dynamic 1D arrays in C. The code below tries to do the following:
malloc
In C, you should not cast the return value of malloc().
malloc()
Also, it's a bad idea to encode the type in the malloc() argument. This is a better way:
double* data = malloc(10 * sizeof *data);