Learn C Language from the Best Tutors
Search in
In C programming language, \n
and \t
are escape sequences used within string literals to represent special characters:
\n
(Newline Character):
\n
is used to insert a newline (line break) character into a string literal or a character constant. When the string containing \n
is printed or displayed, it causes the output to move to the beginning of the next line.printf("Hello\nWorld");
Hello World
\n
causes the string "World" to be printed on a new line after "Hello".\t
(Tab Character):
\t
is used to insert a horizontal tab (tabulation) character into a string literal or a character constant. When the string containing \t
is printed or displayed, it causes the output to advance to the next tab stop.printf("Name:\tJohn\tAge:\t25");
Name: John Age: 25
\t
inserts tabs between "Name:", "John", "Age:", and "25" to align them at specific tab stops.In C language, "\n" represents the newline character, which is used to advance the cursor to the beginning of the next line when printing text. It's commonly used to create line breaks in output. Meanwhile, "\t" represents the tab character, which is used to insert horizontal spacing in text. When encountered in a string, "\t" causes the cursor to move to the next tab stop, aligning text in a neat and organized manner. Both "\n" and "\t" are escape sequences, special characters preceded by a backslash, that allow for the inclusion of non-printable characters and formatting in strings within C programs.
read lessView 3 more Answers
Related Questions
Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com
Ask a QuestionRecommended Articles
Brilliant Academy, a reputed B. Tech Tuition...
Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...
Lasya Infotech: An educational Training...
Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...
Learn Hadoop and Big Data
Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...
Make a Career as a BPO Professional
Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...
Looking for C Language Classes?
Learn from the Best Tutors on UrbanPro
Are you a Tutor or Training Institute?
Join UrbanPro Today to find students near youThe best tutors for C Language Classes are on UrbanPro
The best Tutors for C Language Classes are on UrbanPro