Write a preprocessor command that calculates the maximum of 2 integers.
Difficulty level
This exercise is mostly suitable for students
#include <stdio.h>
#define LARGER(x, y) ((x) > (y) ? (x) : (y))
int main()
{
printf("Value = %d \n",LARGER(1,2));
printf("Value = %d \n",LARGER(1+2*5 , 2 - 3));
return 0;
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Symmetric array