q example of arrays pointersgeneral form of


Q. Example of arrays pointers?

General form of declaration of array in Fortran 90 is

type, DIMENSION(bound) [,attr] :: name

E.g. the declaration 

        INTEGER, DIMENSION(5): A

Declare an array A of size 5.

General representation of declaration of array in C is 

type array_name [size]

E.g. declaration A

   int A[10]

Declares an array of size 10.

Fortran 90 allows using particular sections of an array. To access a part of an array you require name of the array followed by two integer values splitted by colon enclosed in parentheses. The integer values symbolize indices of section needed. E.g. a (3:5) denotes to elements 3, 4, 5 of array, a(1:5:2) denotes to elements 1, 3, 5 of the array and b(1:3, 2:4) denotes to elements from rows 1 to 3 and columns 2 to 4.  In C there is just one type of array whose size is determined statically although there are provisions for dynamic allocation of storage by dynamic memory allocation functions such as malloc and calloc functions and pointers. In Fortran 90 there are 3 probable kinds of arrays depending on binding of an array to some amount of storage: Static arrays with fixed size at the time of declaration and can't be changed at the time of execution, Automatic arrays or Semi-dynamic arrays: the size is decided after entering a subroutine and arrays can be created to match the exact size needed however local to a subroutine and Allocatable arrays or Dynamic arrays: the size can be changed at the time of execution.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: q example of arrays pointersgeneral form of
Reference No:- TGS0323829

Expected delivery within 24 Hours