Problem E2 Passing length info explicitly. Subject Passing length info explicitly. The above approach provides the length info about argument array by putting a special
Problem E2 Passing length info explicitly.
Subject
Passing length info explicitly. The above approach provides the length info about argument array by putting a special sentinel terminator token at the end of the array, like the case of string. But putting a terminator might not always be possible.
Another approach, which is more common for general arrays, is to pass the length info explicitly to the function (as an additional argument).
Specification
Same problem and requirement as above, but this time suppose the input numbers can be both positive and negative so we could not store a special terminator token in the array.
Implementation
Declare and implement function largest(int *, int) and display(int *,int). Same as before, no array index [] should be used in main, except the array declaration. No array index [] should be used in largest and display at all.
Do not use global variables.
Sample Inputs/Outputs:
1 2 33
-445
23
Inputs: 1 2 33 -445 23
Largest value: 33
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started