mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
30 lines
643 B
Fortran
30 lines
643 B
Fortran
!****************************************************************
|
|
!***
|
|
!*** This file belongs with the course
|
|
!*** Introduction to Scientific Programming in C++/Fortran2003
|
|
!*** copyright 2017-2020 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
!***
|
|
!*** assignwrong.F90 : pointer copying done wrong
|
|
!***
|
|
!*** THIS CODE IS WRONG: IT ILLUSTRATES A COMMON CODING ERROR !!!!
|
|
!***
|
|
!****************************************************************
|
|
|
|
|
|
Program AssignPointer
|
|
|
|
implicit none
|
|
|
|
!!codesnippet passignwrong
|
|
real,target :: x
|
|
real,pointer :: p1,p2
|
|
|
|
x = 1.2
|
|
p1 => x
|
|
p2 = p1
|
|
print *,p2
|
|
!!codesnippet end
|
|
|
|
End Program AssignPointer
|
|
|