|
A scan algorithm solves a problem by making one scan over a sequence of values. Examples of scans are adding up a list of numbers and finding the largest value in an array. Scan algorithms occur frequently in practice.
Suppose that A is an array of size n. A boilerplate scan algorithm to scan A is as follows.
An array is a collection of indexed variables, all of the same type. If A is an array then A[i] is the variable in array A at index i. The indices go from 0 to n−1, where n is the size of A. Declaration
int B[n];
creates an array called B of size n.
There is no way to get the size of an array from the array. You need to get that knowledge from another source.
|