what is escape sequence?explain with example with each.
Answers
Answer:
In C programming language, there are 256 numbers of characters in character set. The entire character set is divided into 2 parts i.e. the ASCII characters set and the extended ASCII characters set. But apart from that, some other characters are also there which are not the part of any characters set, known as ESCAPE characters.
Explanation:
1. // C program to illustrate \a escape sequence
#include <stdio.h>
int main(void)
{
printf("My mobile number "
"is 7\a8\a7\a3\a9\a2\a3\a4\a0\a8\a");
return (0);
}
2. // C program to illustrate \b escape sequence
#include <stdio.h>
int main(void) {
printf("Hello Folks\b\b\b\bF");
return (0);
}
3. // C program to illustrate \n escape sequence
#include <stdio.h>
int main(void){
printf("Hello\n");
printf("Dear");
return (0);
}
4. // C program to illustrate \t escape sequence
#include <stdio.h>
int main(void)
{
printf("Hello \t brains");
return (0);
}
5. // C program to illustrate \v escape sequence
#include <stdio.h>
int main(void)
{
printf("Hello friends");
printf("\v Welcome to world");
return (0);
}