replace double *tptr = malloc(n*sizeof(double));
with double *tptr = (double *) malloc(n*sizeof(double));
you need an explicit cast since malloc returns pointers of type void *. otherwise compiler will complain.
you need an explicit cast since malloc returns pointers of type void *. otherwise compiler will complain.