Re: Computer programmers' habits in electronics



"Spehro Pefhany" <speffSNIP@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:0u2kq1h7cm70jgjmj5hari4kug5308ihtn@xxxxxxxxxx
   std::reverse(pStr, pStr + (len ? len : strlen(pStr)));
}

Isn't that kinda cheating?

I suppose you should also ding me for <string.h>.

It's a valid answer, and meaningful of itself. The follow up questions would bring it back to where we started.

If you're not tired of the game yet, write:

// return true if val is an integer power of 2; false otherwise.
bool IsPowerOf2(unsigned val);

.