Ask Question
10 July, 21:35

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

+5
Answers (1)
  1. 10 July, 23:50
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers