I want to dynamically allocate 1 dimension of a 2D array (the other dimension is given). Does this work:
int NCOLS = 20; // nrows = user input... double *a
You have to allocate a new array for each element (each element is a pointer to an array) on the first dimension. You can use a loop for that:
for(i = 0; i < NCOLS; i++) arr[i] = (double *)malloc(sizeof(double)*nrows);
Do the same to free.