Interview Question

A C language macro to compute maximum of two ints is generally written as
#define  max(a,b)   (a > b? a : b)
Now write it without using the ternary operator “?:”

Hint: This is inspired by puzzle #160 in Nick’s Puzzles — An excellent site, also gives hints and solutions.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: