An Interview Question

Filed under: C++ — jac @ February 10, 2005 - 2:54 pm

Here’s some code stolen from The Daily WTF:

ushort GetAsciiValue (uchar ch)
{
    ushort i;
    for (i=0; i<=255; i++)
    {
        if(ch == i)
            return i;
    }
    return 0;
}

It might be interesting to show this code to a candidate for a C/C++ position. Ask him/her if there is anything wrong with this code, and if so, how he/she would implement GetAsciiValue.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>




  



July 2009
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Statistics

There are currently 33 posts and 22 comments, contained within 12 categories.


Miscellaneous
- Source Files

Add to Technorati Favorites


Storage B
-LGPL License Option Added to Qt
-WordPress 2.7
-OpenDDS Version 1.2 Released
-FreeVMS
-OpenDDS Version 1.1 Released
-C++ functions to convert between decimal degrees and degrees, minutes, and seconds
-WordPress 2.5
-Multics
-C++ Functions to Evaluate Chebyshev Polynomials
-OpenDDS

Valid XHTML 1.0!

Valid CSS!