Ask Question
12 April, 00:07

Why should a function that accepts an array as argument also accept an argument specifying the array's size?

+3
Answers (1)
  1. 12 April, 00:22
    0
    An array is of fixed size. You'd set it to a certain size, but it may be the case that the array is not "full", as in you have not used all its "slots", thus you wouldn't want to waste time traversing through the entire array even if after a certain position all the slots are empty. Thus keeping track of the slots that are actually in use, will save time. Accepting an array's size as an argument will guarantee that say a loop only iterates the necessary number of time.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Why should a function that accepts an array as argument also accept an argument specifying the array's size? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers