Re: allocation error
- From: "robin" <robin_v@xxxxxxxxxxx>
- Date: Sat, 30 Dec 2006 23:23:44 GMT
"lane straatman" <grumpy196884@xxxxxxxxxxx> wrote in message
news:1167413501.898092.150810@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
program pascal1
IMPLICIT NONE
integer :: n, i
integer, dimension(:), allocatable :: pascal
allocate(pascal(1:n))
write (*,'(a)', advance='no') 'give me an int'
read (*, '(i3)') n
do i=1, n
pascal(n) = i
write (*, '(i3)') pascal(i)
end do
end program pascal1
This program wants to dynamically allocate an array of rank 1. It
compiles and builds but has the following bug:
It isn't a bug. It's a programming error.
The value of N needs to be read in before
executing the ALLOCATE statement.
Run-time Error
*** Error 112, Reference to undefined variable, array element or
It's describing what the error is -
an undefined variable, viz., N.
.
- Follow-Ups:
- Re: allocation error
- From: AeroSpace Ed
- Re: allocation error
- References:
- allocation error
- From: lane straatman
- allocation error
- Prev by Date: Re: Reading data
- Next by Date: Re: Bit Concatenation
- Previous by thread: Re: allocation error
- Next by thread: Re: allocation error
- Index(es):
Relevant Pages
|