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 

Dimension declaration

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



Joined: 08 Apr 2011
Posts: 155

PostPosted: Mon Jul 04, 2011 2:16 pm    Post subject: Dimension declaration Reply with quote

Please can anyone tell me the difference between declation using DIMENSION or just feclaring as INTEGER/REAL?
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Tue Jul 05, 2011 7:13 am    Post subject: Reply with quote

Lets work with real variable (its the same with integers).

When you want arrays, you can use the dimension keyword. This can either be a dimension statement, or a dimension attribute. For example if you want an array of 10 values you declare it in different ways.

Code:

! Method 1. Using the dimension statement
real a
dimension a(10)

! Method 2. Using the dimension attribute (note :: is mandatory)
real, dimension(10) :: a

! Method 3. Getting by without dimension
real a(10)


There is no difference in behaviour in each case.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
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 -> General 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