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


#1

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


#2

#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;
}