Append to 2d array

See this thread where I suggest RESHAPE intrinsic.

You can use RESHAPE with your example, I personally think that is the better option and one I recommend with intrinsic types :

   integer, allocatable :: arr(:,:)
   allocate( arr(2,0) )
   arr = reshape( arr, shape=[2,1], pad=[9,10] )
   print *, arr
end
4 Likes