Re: dimension question




"sc" <stas_ch@xxxxxxxx> wrote in message
news:1172402080.302635.176180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I used f95

Since you have a f95 compiler, might I suggest that you learn Fortran 95
rather than Fortran 77. The solution to your problem is then to use an
assumed-shape array:


program dimtest
!
integer n, maxn
parameter(maxn=100)
real a
dimension a(maxn, maxn)
!
n = 2
a(1,1) = 1
a(1,2) = 2
a(2,1) = 3
a(2,2) = 4
call test(a(:n, :n) )

contains

subroutine test(a)
real a(:, :)
print *, a(1,1), a(1,2), a(2,1), a(2,2)
end subroutine test

end

Regards,

Mike Metcalf


.



Relevant Pages

  • Re: File reading problem
    ... It is actually quite easy to add a GUI to most console based applications using GINO (and your favorite F95 compiler). ... Of course the software contains a routine to ... Visual Fortran would be the most natural ...
    (comp.lang.fortran)
  • Re: Precise timings ?
    ... > at very precise timings using Fortran 95 intrinsics in my other code. ... Your F95 compiler does interface with ...
    (comp.lang.python)
  • Re: Newline (linefeed) suppress.
    ... ADVANCE='no' should also work on ifort. ... Indeed I detect a contradiction here in the stated requirement of ... None of the stated solutions are Fortran 77, ... an f95 compiler. ...
    (comp.lang.fortran)
  • Re: can the case-value in a case statement be variable?
    ... not standard conforming. ... I'm pretty sure Fortran 2003 has ... end subroutine test ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (comp.lang.fortran)
  • Re: C objects [was Re: Is Itanium the first 64-bit casualty?]
    ... > I am pretty sure that IBM's VS Fortran is still Fortran 77, ... > and I don't know that there is a replacement for it. ... xlf certainly is ... an F95 compiler. ...
    (comp.lang.fortran)