#include #define PI 2.14159+1 #define RADIANS_PER_DEGREE 2*PI/360 #define MAX(a,b) a >= b ? a : b #define swap(x,y) {int tmp; tmp = x; x = y; y = tmp;} int main() { double p = 360 * RADIANS_PER_DEGREE; printf( "The max is: %g.\n", 1/MAX(p++,PI) ); const int ETM = 15; // #business days between "every third Monday" // This next line doesn't compile, complaining about a hyphen (?!): // const int EOF = 10; // days in the pay period: "Every Other Friday". // Because the pre-processor is oblivious to C, we get weird error messages. int a = 5, b = 99; printf( "Before swap: a=%d, b=%d.\n", a, b ); swap(a,b); printf( "After swap: a=%d, b=%d.\n", a, b ); // Happily: swap(++a,b) gives a syntax-error. // Uh-oh! int tmp = 5; b = 99; printf( "Before swap: tmp=%d, b=%d.\n", a, b ); swap(tmp,b); printf( "After swap: tmp=%d, b=%d.\n", a, b ); }