Re: allocation error
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Fri, 29 Dec 2006 09:50:17 -0800
lane straatman <grumpy196884@xxxxxxxxxxx> wrote:
allocate(pascal(1:n))....
write (*,'(a)', advance='no') 'give me an int'
read (*, '(i3)') n
*** Error 112, Reference to undefined variable, array element or
function result (/UNDEF)
That's because your allocate is before you read the value of n. Allocate
is an executable statement. It does its thing when it is executed, which
in this case is before n is defined. My guess is that you are thinking
it does something more complicated like make the array size track the
value of n as n changes. Nope, it is much simpler than that.
Put the allocate after the read.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: allocation error
- From: lane straatman
- Re: allocation error
- From: dpb
- Re: allocation error
- References:
- allocation error
- From: lane straatman
- allocation error
- Prev by Date: allocation error
- Next by Date: Re: allocation error
- Previous by thread: allocation error
- Next by thread: Re: allocation error
- Index(es):
Relevant Pages
|