Google Groups Home
Help | Sign in
Message from discussion Array sections and F90/95 Standard
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Herman D. Knoble  
View profile
 More options May 14, 8:05 am
Newsgroups: comp.lang.fortran
From: Herman D. Knoble <SkipKnobleL...@SPAMpsu.DOT.edu>
Date: Wed, 14 May 2008 08:05:47 -0400
Local: Wed, May 14 2008 8:05 am
Subject: Array sections and F90/95 Standard
Question:  Is the following program F90/F95 Standard conforming?
(It compiles and runs using most any compiller, displaying 3 values of  1.5).

If so, how would one compute the size of the arrray section, x(1,2)?
Or  is the call to foo passing a scalar, period?

In any event...
How can one recode thte following program and determine in subroutine foo
such that foo expects either of two kinds of arguments: either x(1,2) as a scalar
or an array section vector (without using overloading)?

Thanks.
Skip Knoble

real, dimension(2,3) :: x
 x=1.5
 call foo(x(1,2),3)
end

subroutine foo(x,n)
 integer, intent(in):: n
 real, intent(in), dimension(n) :: x
 integer :: i
 write(*,*)"x = ",(x(i),i=1,n)
end subroutine foo


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google