shalinibasu82
Programmer
Hello,
I am new to FORTRAN and just getting hang of it. I have a global variable say counter which I need to pass to a subroutine and do some processing.
FIRST.f90
integer counter
common /coun/counter
counter = 1000
call second
In SECOND.f90
subroutine second
common /coun/counter
print *,'counter is ',counter
counter = counter - 1
print *,'counter is', counter
end
Current I am getting a garbage value. Please let me know if I am missing something. Thanks.
Shalini
I am new to FORTRAN and just getting hang of it. I have a global variable say counter which I need to pass to a subroutine and do some processing.
FIRST.f90
integer counter
common /coun/counter
counter = 1000
call second
In SECOND.f90
subroutine second
common /coun/counter
print *,'counter is ',counter
counter = counter - 1
print *,'counter is', counter
end
Current I am getting a garbage value. Please let me know if I am missing something. Thanks.
Shalini