Question

The C-string cityName[30] can contain ________. A) thirty characters B) thirty one characters C) twenty nine...

The C-string cityName[30] can contain ________.

A) thirty characters

B) thirty one characters

C) twenty nine characters and the null terminator

D) thirty characters and the null terminator

E) None of the above

Homework Answers

Answer #1

In C,

defining string as cityName[30] means it will have string of 30 characters. Also all string is terminated by a NULL string. So that is not something is mentioned but is understood by default.

The number of characters in character array is defined in the square bracket [ ] . The first character will be placed at index 0.

So the correct option is (D).

No space is given to null Terminator while defining size of character array. It is just appended at the last position of array.

If you have any questions comment down and please? upvote thanks

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider strings that contain only the characters A, B, C, D and E. 1- Find a...
Consider strings that contain only the characters A, B, C, D and E. 1- Find a recurrence relation for the number of such strings that contain three consecutive Bs. 2- What are the initial conditions?
Discrete Mathematics A pin consists of 6 characters. Each one of the characters can be digits...
Discrete Mathematics A pin consists of 6 characters. Each one of the characters can be digits (0-9) or letters (upper case only). 1. How many codes are possible if there are no restrictions? 2. How many codes are possible if none of the characters can be repeated? 3. How many codes contain at least one repeated character?
ANSWER IN C++ ONLY A string of characters including only alphabets (lowercase letters) is provided as...
ANSWER IN C++ ONLY A string of characters including only alphabets (lowercase letters) is provided as an input. The first task is to compute the frequency of each character appearing in the string. In the output, the characters have to be arranged in the same order as they appear in the input string. Then characters have to be rearranged, such that all the characters having a specific frequency, say xx, come together. Let the frequency of a character, lying in...
This is for C++ A string is a palindrome if reverse of the string is same...
This is for C++ A string is a palindrome if reverse of the string is same as the original string. For example, “abba” is palindrome, but “abbc” is not palindrome. Basically a string with a plane of symmetry in the middle of it is considered a palindrome. For example, the following strings are palindromic: "abbbbba", "abba", "abbcbba", "a", etc. For this problem, you have an input string consisting of both lowercase or uppercase characters. You are allowed to pick and...
1) Explain the difference between: Array of characters like char c[] = {'A', 'B', 'C'}; AND...
1) Explain the difference between: Array of characters like char c[] = {'A', 'B', 'C'}; AND c-string like string = "ABC"; 2) We can have two pointers that point to one memory location such as: int *intPtr1, *intPtr2; intPtr1 = &x; intPtr2 = &x; a) What method we have to make sure only one pointer points to a variable? b) Give an example. 3) a) Can a pointer to a constant receive an address of a constant item and/or non-constant...
How many permutations of the set {A, B, C, D, E, F, G, H} a) Contain...
How many permutations of the set {A, B, C, D, E, F, G, H} a) Contain the string DEF? b) Contain the strings ABE and EFG? c)Have D next to C? d) Contain the strings DCB and BAD?
In a large university, 20% of the students are male. If a random sample of twenty-two...
In a large university, 20% of the students are male. If a random sample of twenty-two students is selected. a. What is the probability that the sample contains exactly twelve male students? b. What is the probability that the sample will contain no male students? c. What is the probability that the sample will contain exactly twenty female students? d. What is the probability that the sample will contain more than nine male students? e. What is the probability that...
Give the number of core electrons for Se. A) 26               B) 30               C) 28     &nb
Give the number of core electrons for Se. A) 26               B) 30               C) 28               D) 32               E) 34 (1) Which the following orbitals can hold two electrons? A) 3s                                     B) 2px                                                         C) 4dxy D) all of the above                E) none of the above
Which of the following substances would contain a polar covalent bond? a. Cl2 b. HCl c....
Which of the following substances would contain a polar covalent bond? a. Cl2 b. HCl c. NaCl d. All contain polar covalent bonds e. None contain polar covalent bonds
Which of the following substances would contain a pure covalent bond? a. Cl2 b. HCl c....
Which of the following substances would contain a pure covalent bond? a. Cl2 b. HCl c. NaCl d. All contain pure covalent bonds e. None contain pure covalent bonds
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT