Is there an error in this code:
#include <iostream>
using namespace std;
int main()
{
std:cout << "hello" "\n";
}
GCC detects no error but std:cout
does not seem standard.
There's no error. I could rewrite your code to make it clearer:
#include <iostream>
using namespace std;
int main()
{
std:
cout << "hello" "\n";
}
You created a label named std
. cout
is used unqualified, which is okay since you have the using-directive for std
above it. And you can concatenate string literals by writing them next to each other as you did. This is perfectly well-formed code that prints "hello" followed by a newline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With