Programming in C, autumn 2008
Exercise 3
MON Sep. 22 12:15-15:00 BK106
#define MIN(x,y) x < y ? x : yShow the fully expanded form of the following expressions and calculate the values of these expressions:
1 + MIN(2,3) 1 + MIN(3,2) MIN(2,3) + 1 MIN(3,2) + 1Write a macro MED(a,b,c), which prints 1 if the value of b is between a and c; otherwise it prints 0. Assume a, b, c are integers.
1.2 3.4 6 2.4 5 9the output file would contain:
1.2 2.4 3.4 5 6 9Use conditional compiling and change the program so that in a debugging mode, the program displays a message informing the user as from which input file is being read, if the reading is not successful.
1 1 1 2 1 1 3 3 1 1 4 6 4 1Write also a main program, which you can use to test the function.