Ask Question
11 June, 21:16

Which of the following is NOT a valid declaration for a character string?

a) char string1[3] = {"1", "2", '3', 4}

b) char string1[12];

c) char string1[] = "this is a string";

d) char string1[25] = "this is a string";

+3
Answers (1)
  1. 12 June, 00:16
    0
    a) char string1[3] = {"1", "2", '3', 4}

    Explanation:

    In the declaration we have a string of size 3 from which 1 block is reserved for null character and we are declaring a string of size 4 and out them two are of type string and 1 is a character and 1 is an integer.

    All the other three declarations are correct they will run on the IDE.

    So we can say that the answer to this question is option a.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following is NOT a valid declaration for a character string? a) char string1[3] = {"1", "2", '3', 4} b) char string1[12]; c) ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers