Point out an error in the program.
Point out an error in the program.
#include <iostream>
using namespace std;
int main()
{
char s1[] = "Hello";
char s2[] = "world";
char *const ptr = s1;
*ptr = ‘a’;
ptr = s2;
return 0;
}
A . No error
B . Cannot modify a const object
C . Compilation error at line 9
D . None of these
Answer: B, C
Latest CPA-21-02 Practice Questions with 222 Q&As
Updated Study Material | Instant Download | Detailed Answers and Explanations
Subscribe
Login
0 Comments