Candidate Screening Challenges (Was: Crazy idea from a recruiter)

Nicholas Leippe nick at
Thu Mar 28 13:50:04 MDT 2013

On Thu, Mar 28, 2013 at 12:40 PM, Sasha Pachev <sasha at> wrote:
>>> - Assuming you are on a reasonable Unix platform, can you add some
>>> magic around the code without inserting anything in between the above
>>> two lines so that it would actually print Hello, world! in spite of
>>> the egregious error?
>>Sure. Above it define a macro named 'strcpy' that ignores its first
>>parameter and simply calls printf("%s", b) with its second parameter
> The above can work just as well on any platform, not just Unix.  Now
> we need to clarify - without the use of #define black magic, can we
> make this happen. Hint:
> can you make the following C code print "Hello, world" on  a
> reasonable Unix platform by adding some actual code before it:
> a = b/0;
> ?

printf("%s", "Hello, world!");
a = b/0;

prints it, but still causes a floating point exception. Did you
specify this must be avoided? Deleting the div by zero line seems the
better solution. :)

I did notice the 1 bit difference between 43 and 11, but forgot you
could declare specifically sized bit fields in C. I'm a bit rusty.

More information about the PLUG mailing list