Skip to content
Quiz · References and Pointers · lesson 7 of 9

Quiz — what is const here

Which line of this program does not compile?

C++
int main() {
    int a = 1;
    int b = 2;
    const int* p = &a;
    int* const q = &b;
    p = &b;
    *p = 4;
    *q = 3;
    return a + *p;
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way