summaryrefslogtreecommitdiff
path: root/tigrou/use-an-array/use-an-array.tih
blob: 55a7d5a21ab5b89713850e1f462138fc8bfd3b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
type int_array = array of int
function max_search(a : int_array, size : int) : int =
	if size <= 0 then -1
	else
		let
			var maxi := 0
		in
			(for i := 1 to size - 1 do
				if a[maxi] < a[i] then
					maxi := i);
			maxi
		end