Ask Question
12 July, 12:21

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";

+2
Answers (1)
  1. 12 July, 13:09
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers