Thread: Doubt

  1. #1
    Registered User
    Join Date
    Jan 2008


    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

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    compiler take escape seqence /n /a /b etc
    take as one charecterwhy tell me reason behind it?
    Because '\n', '\a', '\b' etc represent one character each.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Join Date
    Nov 2007
    well compiler alsoconfuses the / with the \ soit misunderstands itasone character
    Last edited by manav; 02-01-2008 at 03:01 AM.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    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").

    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubt in pointer.
    By shwetha_siddu in forum C Programming
    Replies: 5
    Last Post: 03-21-2009, 01:28 AM
  2. doubt regarding C structure in linux
    By Bargi in forum C Programming
    Replies: 2
    Last Post: 01-23-2007, 06:18 AM
  3. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  4. Doubt abt Storage!
    By kalamram in forum C Programming
    Replies: 1
    Last Post: 04-21-2006, 05:30 AM
  5. Greatest C++ Doubt
    By vasanth in forum C++ Programming
    Replies: 15
    Last Post: 02-28-2002, 04:41 AM