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
2 Respostas
+ 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 ^^
+ 1
oh, thanks