Sobes.tech
Junior — Senior

Check if the code can successfully compile and run

livecode

Task condition

It is necessary to determine whether this program fragment will compile and, if the compilation is successful, whether it will run without errors. Consider the following example in C:

# include <stdio.h>

int main() {
    const char *str = "123";
    const char s[] = "abc";

    str[0] = 'a';
    *(s + 1) = '2';
    s[0] = '1';

    return 0;
}

Identify which of the listed operations violate the language rules and will lead to compilation or runtime errors.