FORTRAN90程序请求帮忙解释
原程序如下:programpointimplicitnonereal,pointer::p1(:)real,allocatable,target::p2(:,:)allo...
原程序如下:
program point
implicit none
real, pointer :: p1(:)
real,allocatable,target::p2(:,:)
allocate(p1(1:3))
p1=3.6
write(*,'(1x,3f6.1)')p1
allocate(p2(1:3,2))
p2=2.4
p2(1:3:2,2)=6.8
write(*,'(1x,3f6.1)')p2
p1=>p2(2:3,2)
write(*,'(1x,3f6.1)')p1
deallocate(p2)
end program
运行结果是:
3.6 3.6 3.6
2.4 2.4 2.4
6.8 2.4 6.8
2.4 6.8
敬候佳音!
运行结果看不懂,比如:p2(1:3:2,2)=6.8 什么意思?恳请高手帮忙解释,不甚感激!!! 展开
program point
implicit none
real, pointer :: p1(:)
real,allocatable,target::p2(:,:)
allocate(p1(1:3))
p1=3.6
write(*,'(1x,3f6.1)')p1
allocate(p2(1:3,2))
p2=2.4
p2(1:3:2,2)=6.8
write(*,'(1x,3f6.1)')p2
p1=>p2(2:3,2)
write(*,'(1x,3f6.1)')p1
deallocate(p2)
end program
运行结果是:
3.6 3.6 3.6
2.4 2.4 2.4
6.8 2.4 6.8
2.4 6.8
敬候佳音!
运行结果看不懂,比如:p2(1:3:2,2)=6.8 什么意思?恳请高手帮忙解释,不甚感激!!! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询