0

I think their is a bug in SoloLearn c++

for some reason this code gives an error even though it is correct #include <iostream> using namespace std; int main() { int a = 5; return 0; } is it SoloLearn or me

4th Nov 2019, 1:06 AM
Endro
Endro - avatar
2 ответов
+ 6
Endro , It's not a bug, it's a feature. It's not error ,it's a warning 😄 Sololearn compiler is warning you because you have declared a variable but not using it. You can suppress such warnings by using maybe_unused attribute or just delete that declaration if you are not going to use it. [[maybe_unused]] int a=5; It'll not show you warning for unused `a`. https://en.cppreference.com/w/cpp/language/attributes/maybe_unused Happy learning ^^
4th Nov 2019, 4:02 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
oh, thanks
4th Nov 2019, 4:30 AM
Endro
Endro - avatar