Write a preprocessor command that calculates the sum of 3 integers.
Difficulty level
This exercise is mostly suitable for students
#include <stdio.h>
#define SUM(x, y, z) ((x)+(y)+(z))
int main()
{
printf("Value = %d \n",SUM(1,2,3));
printf("Value = %d \n",SUM(1+2*5 , 2-3, 4%6));
return 0;
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Replace successive occurrences of the same character with a single character occurrence