{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Computational Arrays and Matrix Computations

Computational Arrays and Matrix Computations -...

Info icon This preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Computational Arrays and Matrix Computations Outline: Introduction to Matrix Declaration of Computational Arrays Initialization of Computational Arrays Array Reference Formatted Input/Output of Computational Arrays Array Operations Pass Computational Arrays to Functions Type Generic Array Functions Some Commonly Used Array Functions Sample Problem
Image of page 1

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

View Full Document Right Arrow Icon
Declaration of Computational Arrays Computational arrays are treated as first-class objects in Ch. Computational arrays are declared with the type qualifier array defined in array.h . Programs using computational arrays should include the header file array.h . At the interactive prompt in Ch shell, computational arrays can be used without header file array.h. The code segment below declares computational arrays a1, a2, a3, a4. One-dimensional arrays a1, a2 , and a3 are of int type with ten elements. The subscript ranges of arrays a1 and a2 are from 0 to 9. The subscript range of array a3 is from 1 to 10. Array a4 is a two- dimensional array. #include <array.h> int main() { array int a1[10]; // a1[0], ..., a1[9] array int a2[0:9]; // a2[0], ..., a2[9] array int a3[1:10];// a3[1], ..., a3[10] array double a4[10][10]; /* ... */ }
Image of page 2