contestada

In order to store the newline character in a char variable named advanceToNextLine, you would write ____.a.advanceToNextLine = ‘\‘ + ‘n’;b.advanceToNextLine = ‘\n’;c.advanceToNextLine = "\n";d.advanceToNextLine = \n;

Respuesta :

Answer:

b. advanceToNextLine = ‘\n’;

Explanation:

The syntax to use char data type is

char variable_name = 'character';

Note:

For char data type we always use single quotes and for string data type we use double quotes!

new-line character is represented by \n

Now lets arrange this information to create a variable named advanceToNextLine to store a new-line character in it.

char advanceToNextLine ='\n';

Hence the correct answer is option b

a. advanceToNextLine = ‘\‘ + ‘n’; syntax is wrong (invalid)

b. advanceToNextLine = ‘\n’; (valid)

c. advanceToNextLine = "\n"; double quotes are used (invalid)

d. advanceToNextLine = \n; single quotes are missing (invalid)