Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
9 Views

lbound and ubound

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...

 

0 Kudos
2 Replies
Highlighted
9 Views

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.)

Retired 12/31/2016
0 Kudos
Beginner
9 Views

Thank you, Steve!

0 Kudos