Skip to content

Files

Latest commit

 

History

History

21

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Exercise 6.21

Write a function that takes an int and a pointer to an int and returns the larger of the int value or the value to which the pointer points. What type should you use for the pointer?

Solution

int larger(const int &i, const int *const j)
{
    return (i > *j) ? i : j;
}