Ask 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) char string1[] = "this is a string";

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

+4
Answers (1)
  1. 3 July, 11:01
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers