- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I transfer to the following subroutine array C as argument with bounds (0:450):
subroutine A(B,C)
real*8 B, C(:)
integer LB, UB
...
LB=lbound(C)
UB=ubound(C)
...
end subroutine A
But in fact, lb=1, and ub=451.
What's wrong? I suspect myself...
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's the definition in the standard. Think about what LBOUND and UBOUND might be if you passed C([2,17.24,6]) or C(4:45:3). Unless the dummy argument is a pointer and you pass a pointer, LBOUND will always be 1 and UBOUND always the extent of the associated actual argument. (Unless you specify a different lower bound on the dummy, of course.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Steve!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page