Answer

What the subroutine doesn't know won't hurt it! We tell the subroutine that the array contains only N elements because only the first N elements are meaningful. There's no need to deal with the remaining elements, and this way the subroutine won't. And it's safe to use this innocent ``lie'' since we've checked that the number ``N'' is smaller than the actual size ``SIZE''.

Return to lesson.



Hamlet Project
hamlet@cs.utah.edu