min

#define min(a,b) ((a)<(b)?(a):(b))

This macro returns the minimum of two items. It will work for any two things of the same type, as long as they have operator< overloaded for them.

Usage:

int a = 5;
int b = 7;
int c = min(a, b);	//c is now a, which is 5

Related Posts