Pointers and Arrays on C related Questions and Answers


Question :   What type of initialization is needed for the segment 'ptr[3] = '3';' to work?
1. char *ptr = “Hello!”;
2. char ptr[] = “Hello!”;
3. both char *ptr = “Hello!”; and char ptr[] = “Hello!”;
4. none of the mentioned
Answer :   2 - char ptr[] = “Hello!”;  

* Be the First to Post a Comment.

Submit comment :


Captcha Image
Reload

Ask Question

Captcha Image
Reload

Note : Name and Email never shown.





Subscribe


Become a part of EducationForever. Subscribe to our FREE Newsletter