module example implicit none contains subroutine AShape(bufSize, buffer) integer :: bufSize integer,dimension(*) :: buffer write(*,*) buffer(1:bufSize) end subroutine end module example program test use example implicit none integer :: oneD(16) integer :: twoD(4,4) integer :: threeD(3,3,3) integer :: i,j,k do i=1,16 oneD(i) = i enddo do j=1,4 do i=1,4 twoD(i,j) = i + (j-1)*10 enddo enddo do k=1,3 do j=1,3 do i=1,3 threeD(i,j,k) = i + (j-1)*10 + (k-1)*100 enddo enddo enddo write(*,*) '1D:' call AShape(16, oneD) write(*,*) write(*,*) '2D:' call AShape(16, twoD) write(*,*) write(*,*) '3D:' call AShape(27, threeD) end program test