max

Syntax

int max(int a, int b)

Arguments

a
Any integer.
b
Any integer.

Return

The greater value of a and b.

Description

Returns the greatest of the two given values a and b.

A common use for max is to truncate a variable to a certain lower boundary.

Example

// sets p to 2
int p = max(1, 2);

See Also

add, min, sub

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.