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

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

Also see

add, min, sub

Comments

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