czwartek, 18 września 2014

String literals are weird (at least in C/C++)

Simple quiz: what is the length of this string "\xbadcafe"?
  1. 5 letters
  2. 4 letters
  3. 2 letters
  4. 1 letter
The correct answer is d, i.e. single letter. In C/C++ escape sequence "\x..." consumes all hexadecimal digits.

Brak komentarzy:

Prześlij komentarz