alloc function for simple arrays