Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10 Additional Features of Arrays Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul.

Similar presentations


Presentation on theme: "Chapter 10 Additional Features of Arrays Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul."— Presentation transcript:

1 Chapter 10 Additional Features of Arrays Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul - Turkey Tel: +90 (212 285 6519) Fax: +90 (212 285 6508) E-mail: takinaci@itu.edu.tr

2 Additional Features of Procedures PASSING MULTIDIMENSIONAL ARRAYS TO SUBROUTINES AND FUNCTIONS Multidimensional arrays can be passed to subroutines or functions in a manner similar to that for one-dimensional arrays. However, the subroutine or function will need to know both the number of dimensions and the extent of each dimension in order to use the array properly. © 2010, Dr. ALİ CAN TAKİNACI Slide No: 2

3 Additional Features of Procedures 1. Explicit-Shape Dummy Arrays The first approach is to use explicit-shape dummy arrays. In this case, we pass the array and the extent of each dimension of the array to the subroutine. The extent values are used to declare the size of the array in the subroutine, and thus the subroutine knows all about the array. When explicit-shape dummy arrays are used, the size and shape of each dummy array in the subprogram is known to the compiler. © 2010, Dr. ALİ CAN TAKİNACI Slide No: 3

4 Additional Features of Procedures 2. Assumed-Shape Dummy Arrays Assumed-shape arrays are declared by using colons as placeholders for each subscript of the array. These arrays work only if the subroutine or function has an explicit interface, so that the calling program knows everything about the subroutine interface. © 2010, Dr. ALİ CAN TAKİNACI Slide No: 4

5 Additional Features of Procedures One and Two Dimensional Array (Matrix) Intrinsics Fortran provides three intrinsic functions specifically designed for vector and matrix operations, where it is assumed that matrices are stored in two-dimensional arrays and vectors are stored in one- dimensional arrays. © 2010, Dr. ALİ CAN TAKİNACI Slide No: 5


Download ppt "Chapter 10 Additional Features of Arrays Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul."

Similar presentations


Ads by Google