Iam a lerner of c lanuage
my question is that
compiler take escape seqence /n /a /b etc
here '\' and 'a' are two chareters the the compiler
take as one charecterwhy tell me reason behind it??????
Iam a lerner of c lanuage
my question is that
compiler take escape seqence /n /a /b etc
here '\' and 'a' are two chareters the the compiler
take as one charecterwhy tell me reason behind it??????
Last edited by sureshsuresh528; 02-01-2008 at 02:37 AM. Reason: to get clarify
Because '\n', '\a', '\b' etc represent one character each.compiler take escape seqence /n /a /b etc
take as one charecterwhy tell me reason behind it?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
well compiler alsoconfuses the / with the \ soit misunderstands itasone character
Last edited by manav; 02-01-2008 at 03:01 AM.
The reason those "escape codes" are uses is that there is no (easy) way to represent characters such as backspace, newline and bell-sound - they are traditionally "unprintable" - so to make them easily visible, the compiler allows the use of '\n' for newline, '\b' for backspace and '\a' for "bell" (or "alarm").
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.