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??????
This is a discussion on Doubt within the C Programming forums, part of the General Programming Boards category; Iam a lerner of c lanuage my question is that compiler take escape seqence /n /a /b etc here '\' ...
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 01: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?
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
well compiler alsoconfuses the / with the \ soit misunderstands itasone character![]()
Last edited by manav; 02-01-2008 at 02: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.