min

Syntax

int min(int a, int b)

Arguments

a
Any integer.
b
Any integer.

Return

The lower value of a and b.

Description

Returns the least of the two given values a and b.
A common use for min is to truncate a variable to a certain upper boundary.

Example

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

Also see

add, max, sub

Comments

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