174k views
2 votes
Why do we need to pass a size as well as the array to any function/procedure where we want it to use this array?

User Jeff Glass
by
7.1k points

1 Answer

3 votes

Step-by-step explanation:

In C++ or C we don't have a function which tells us the size of array which is required.So it is necessary to pass the size of the arrays in the function.At the time of declaration we declare the size of the array more than we need.Then we store the elements upto the size which is necessary.So the actual size of the array is larger than the size we needed.So hence it is necessary to pass the size of the array.

User Paulino III
by
7.6k points