Home / C Programming / Strings :: Discussion

Discussion :: Strings

  1. Which of the following statements are correct about the below declarations?
    char *p = "Sanjay";
    char a[] = "Sanjay";

    1: There is no difference in the declarations and both serve the same purpose.
    2: p is a non-const pointer pointing to a non-const string, whereas a is a const pointer pointing to a non-const pointer.
    3: The pointer p can be modified to point to another string, whereas the individual characters within array a can be changed.
    4: In both cases the '\0' will be added at the end of the string "Sanjay".

  2. A.
    1, 2
    B.
    2, 3, 4
    C.
    3, 4
    D.
    2, 3

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment