The material is intended to supplement the textbook by providing further examples and discussion. It is not self-standing, but assumes that you have a copy of the book to hand.
Stype* fun() {
Stype a[10];
...
return a;
} // fun
What would happen when we made the call:
Stype* b = fun();What change should we make to the function definition?
package vec is
type vector is private;
function add(a, b: in vector) return vector;
function largest(a: in vector) return real;
private
type vector is array (1 .. 6) of real;
end vec;
Show how you would declare variables of type vector
in Ada and give examples of calls of add and largest.
Convert the above Ada package into a generic package which can be instantiated to deal with vectors of any length and whose elements are of any scalar type.