Welcome to this article, here we will discuss the various escape sequences in the c language.
Escape sequences are the special characters that we used inside our programming.
The backslash is considered an escape sequence because it causes an escape from the normal interpretation of a string so that the next characters have special meaning.
In c language there are many types of escape sequences are available such as-
\n, \b,\t,\r,\’,\” etc and these escape sequences have separate meanings and separate work also.
Various types of escape sequences in c language :
This is the most popular escape sequence used to move our cursor into the next lines.
Suppose if you want to print the hello programmers in separate lines then how you should do that, well most of the programmers will do wrong things by writing the text into separate lines, but that is not the correct method at all, and the program will appear in the same line.
So in this case we can use the \n escape sequence.
This is the correct method, here we mention the escape sequence in the same line, we can also write the text programmer in the same line also.
This is another escape sequence which we use for tab space.
Suppose you want spaces into your hello programmer text, so what the beginners do, they create spaces inside their program but that is not correct.
So to overcome this situation we can use the \t, which creates an 8 bits space in between two words.
This is a correct example of \t and it creates spaces in between two words.
Another kind of escape sequence is \b. Suppose if you want to go 1 step behind in this case we can use the \b escape sequence. It is used to give backspace.
This will move our cursor in the character a and blink on that.
This will display the name surydev because of \b a erase and that surydev displayed.
this will display the name surdev , because of \b another character is erased, so in this method, we can use the \b characters inside the c program.
This is our next escape sequence which means carriage return. And with the help of this feature, our cursor will be removed into the first position.
this will show the result surya and because of the \r s will blinked.
This will displayed the result Divya instead of Surya because with the help of \r we already move our cursor in the first position and write Divya instead of Surya.
This is another escape sequence that introduces a beep alert sound into our computer.
This is another escape sequence which indicates a back slash.
Suppose if you want to print this \surya\dev then the program should like this.
This is another type of escape sequence which is used to print a double quotation inside our programming.
Suppose if you want to print the “Surya dev ” then you have to program like this.
In this article, we discussed the various types of escape sequences in the c language.
To read this kind of informational article please follow our websites.