Dynamic allocation of 1d array in c