62.0k views
3 votes
In addition to the \\ that you used to create a new line in C, several other escape characters exist including:i. a Bell (speaker beeps)ii. b Backspace (non-erase)iii. f Form feed/clear screeniv. n New linev. r Carriage Returnvi. t Tabvii. v Vertical tabviii. \ Backslashix. ? Question markx. ' Single quotexi. " Double quoteThey all are implemented the same way by placing a backslash in front of the character (e.g. \v \t ...)Of course the end results will be different for each. Using the hello, world example as a template, modify the statement that includes the \\ and add one or more additional escape characters from the list above. Show your code and explain what happened.

1 Answer

5 votes

Answer:

Answer is explained below

Step-by-step explanation:

List of escape character and their use:

\a Alarm or Beep

\b backspace character transfers the cursor one character back

\f Form Feed

\\ New Line

\r Carriage Return Character

\t Tab (Horizontal) \t is a horizontal tab character

\v Vertical Tab character

\\ Backslash (escape sequence to print backslash)

\? Question Mark

\' Single Quote (Escape character to print ' single quote)

\" Double Quote (Escape character to print " double quote)

#include <stdio.h>

int main()

{

printf("Hello World\\");

printf("H\ae\al\al\ao World\\");

printf("Hello Wo\b\brld\b\b\b\\");

printf("Hello World\\");

printf("Hello wr \r old\\");

printf("Hello \tWorld\\");

printf("Hello"); printf("\v world\\");

printf("Hello\\World\\");

printf("\?Hello World\\");

printf("\'Hello World\\");

printf("\"Hello World\\");

return 0;

}

Output:

In addition to the \\ that you used to create a new line in C, several other escape-example-1
User USeRnAmEhAhAhAhAhA
by
4.4k points