Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran 90 Programmer's Reference: HP Series 700/800 Computers > Chapter 3 Data types and data objects

Data initialization

» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Compile-time data initialization can be carried out using type declaration statements and DATA statements. The format of the DATA statement is fully described in Chapter 10, where the initialization formats for each of the intrinsic type declarations are also specified.

In the following example, data is declared and then initialized, using DATA statements:

INTEGER i
LOGICAL test
CHARACTER(LEN=10):: string
REAL,DIMENSION(2,4) :: array
COMPLEX,DIMENSION(3) :: zz
DATA i,test,string/21,.TRUE.,'10 letters'/
DATA zz/3*(1.0,2.0)/  ! Using a repeat factor.
DATA ((array(i,j),i=1,2),j=1,4)/1.0,2*2.0,5*3.0/
! Using an implied DO loop.
! i = 21  test = .TRUE.
! string = '10 letters'
! All elements of zz = (1.0,2.0)
! The 8 elements of array are
! 1.0 2.0 3.0 3.0
!   2.0 3.0 3.0 3.0
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1996 Hewlett-Packard Development Company, L.P.