Chapter8 - ComputerProgramming usingFortran77...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Programming using Fortran 77 Chapter 8 – 1-Dimensional Arrays
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Arrays We have discussed integer, real, character, etc. .. data types All our data types so far have been for a  single variable We have also considered files. File - a collection records.  Records may be composed of various data types We need a way to process a collection of fields when all the  fields have the same data type 
Background image of page 2
Arrays Example - 22 students, 22 grades,  22 variables  in a pgm We need a  single variable multi-data  structure When we processed a file from beginning to end:  no direct access, i.e., we did not go directly to record number 5 in a  file Simple data type: a single item of 1 type, - field/variable Structured data type: a collection of items of 1 type -  this is an  array
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Arrays Array - a data structure that incorporates a fixed number  of data elements, all of the  same  type, which may  subsequently be accessed  directly . Example: Type:  integer Name:  arrnum 1.  55 The subscript is always of type integer
Background image of page 4
Array: Components Components of an array:  1. name 2. elements 3. subscript (index) - The name & elements will all be the same type, i.e.,  integer, real, etc. - subscript will always be integer - may access the entire array by referencing the name of  the array or a specific element in the array with the  subscript (index)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Array: Syntax type   name  (number of elements) Example: integer arrnam(5) Example: integer limit parameter(limit = 5) integer arrnam(limit) arrays may be passed as an argument to a function or a  subroutine - lab6
Background image of page 6
Array: Declaration Declaration of an integer array LIST consisting of 20 elements.       INTEGER   LIST (20)   Declaration of a logical array FLAG that consists of 30 elements. LOGICAL   FLAG (30)   Declaration of a character array NAMES that consists of 15  elements with each element of size 20.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/18/2011 for the course CMPS 301 taught by Professor Staff during the Fall '08 term at University of Louisiana at Lafayette.

Page1 / 27

Chapter8 - ComputerProgramming usingFortran77...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online