Which of the following are C-string constants? Give the number of characters in each of these.

a. ‘\n’
b. ‘n’
c. “Lamb\n”
d. “Mary”
e. “M”

c) d) and e) are C-strings.
Explanation: In a), and b) ‘n’ and ‘\n’ are character constants. The number of characters: In a) 1, the \n is an escape sequence. b) 1 character. c) 5 characters in the characters in Lamb, plus 1 for the new line, plus 1 more for the terminator, for a total of 6 . d) has five characters, including ‘\0’ e) has two including ‘\0’.

Computer Science & Information Technology

You might also like to view...

Operators used to compare two values, such as <= and = are called ________ operators

Fill in the blank(s) with correct word

Computer Science & Information Technology

By default, the ____ is set for all items to display and print.

A. print options B. print range C. print target D. print index

Computer Science & Information Technology