Basic and Advance C Question:

Download Job Interview Questions and Answers PDF

why isnt it being handled properly?

C Programming Interview Question
C Programming Interview Question

Answer:

I'm reading strings typed by the user into an array, and then printing them out later. When the user types a sequence like n, why isn't it being handled properly?

Character sequences like n are interpreted at compile time. When a backslash and an adjacent n appear in a character constant or string literal, they are translated immediately into a single newline character. (Analogous translations occur, of course, for the other character escape sequences.) When you're reading strings from the user or a file, however, no interpretation like this is performed: a backslash is read and printed just like any other character, with no particular interpretation.
(Some interpretation of the newline character may be done during run-time I/O, but for a completely different reason;

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
How do I convert a string to all upper or lower case?How can I read/write structures from/to data files?