Sail E0 Webinar
Question

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 '' will be added at the end of the string "Sanjay".


Options:
A .  1, 2
B .  2, 3, 4
C .  3, 4
D .  2, 3
Answer: Option B

No answer description available for this question. 



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers