max

#define max(a,b) ((a)>(b)?(a):(b))

This macro returns the maximum of two items, as long as they ahve operator> overloaded for them.

Usage:

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

Related Posts