#include #include using namespace std; using namespace std; void maxValue(int valuel, int value2, int max) { if (valuel > value2) max = valuel; else void maxValue(int valuel, int value2, int& max) { if (valuel > value2) max = valuel; else max = value2; } max = value2; } int main() { int main() { int max = 0; int max = 0; maxValue(1, 2, max); cout <« "max is " << max << end%; maxValue (1, 2, max); cout <« "max is " << max « endl; return 0; } return 0; } (a) (b)
#include #include using namespace std; using namespace std; void maxValue(int valuel, int value2, int max) { if (valuel > value2) max = valuel; else void maxValue(int valuel, int value2, int& max) { if (valuel > value2) max = valuel; else max = value2; } max = value2; } int main() { int main() { int max = 0; int max = 0; maxValue(1, 2, max); cout <« "max is " << max << end%; maxValue (1, 2, max); cout <« "max is " << max « endl; return 0; } return 0; } (a) (b)
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
Related questions
Question
What is pass-by-value? What is pass-by-reference? Show the result of the following
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Recommended textbooks for youEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT