Which lines will be executed/compiled with errors?
char *s1((char *)("foo"));  //1
char s2[] = "foo";  //2
char *s3 = (char *) new char[10];  //3
s1[2] = 'a';  //4
*s2 = 'b';  //5
3[s3] = 'c';  //6
Explanation
The fourth line tries to change the constant memory area. The sixth line is correct. You can read the details here: Accessing array elements.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести