Skip to content
Quiz · Variables and Types · lesson 3 of 9

Quiz — which initialization fails to compile

Which line does not compile?

C++
#include <iostream>

int main() {
    int a = 2.9;
    int b(2.9);
    double c{2};
    int d{2.9};
    std::cout << a << b << c << d << '\n';
}

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