#define MAX(A,B) ((A) > (B) ? (A) : (B))


Can anyone please explain me what does this mean? #define MAX(A,B) ((A) > (B) ? (A) : (B))


#define MAX creates MAX as a macro, a parameterised name, for the expression ((A) > (B) ? (A) : (B)).

When evaluated, the expression ((A) > (B) ? (A) : (B)) yields the value of the expression A if the value of A is greater than the value of B otherwise gives the value of B.

It is a bit like this function:

long Max (const long A, const long B)
   long result = B;
   if (A > B) {
       result = A;
   return result;