replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - how to calculate elements in an array!
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to calculate elements in an array!

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
lawchellie



Joined: 22 Dec 2011
Posts: 8

PostPosted: Fri Mar 23, 2012 10:59 am    Post subject: how to calculate elements in an array! Reply with quote

when have an array of the type [-4:8], how many elements make up the array? a little bit confuse when calculating the number of elements of this type. thanks for assistance
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 506
Location: Sunderland

PostPosted: Fri Mar 23, 2012 1:24 pm    Post subject: Reply with quote

-4 -3 -2 -1 0 1 2 3 4 5 6 7 8

=13
Back to top
View user's profile Send private message Send e-mail
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Sat Mar 31, 2012 5:39 am    Post subject: Reply with quote

In the following example, it shows there are 13x2 elements in either array, but the size of each element depends on what it is defined. Size does not return the upper limit of the array.
Code:
      TYPE ACTIVE_DAY_RECORD
         integer*2 trains
         integer*2 ships
         integer*2 movements
      END TYPE ACTIVE_DAY_RECORD
!
      type (active_day_Record), parameter :: active_day_zero = active_day_record (0, 0, 0)
!
      type (active_day_record) active_days(-4:8,2)

      integer*4 aa(-4:8,2)
!
      aa          = 0
      active_days = active_day_zero
!
      write (*,*) 'size aa          ', size (aa,1), size(aa)
      write (*,*) 'size active_days ', size (active_days,1), size (active_days)
!
      end
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group