CPA practice question 21 of 30

Point out an error in the program. #include using namespace std; int main() { char s1[] = "Hello"; char s2[] = "world"; char *const ptr = s1; *ptr = 'a'; ptr = s2; return 0; }

Full set: 220 questions
Answer options
A: No error
B: Cannot modify a const object Correct answer
C: Compilation error at line 9 Correct answer
D: None of these
Correct Answer:
B. Cannot modify a const object; C. Compilation error at line 9
Scroll to Top