Why doesn't the line below work?
#include <iostream>
std::ostream& operator <<( std::ostream& os, const char *c)
{
os << c; // why does this line doesn't work?
return os;
}
int main()
{
const char *c = "Hi";
std::cout << c;
}
The problem is std::ostream& operator <<( std::ostream& os, const char *c) has already been overloaded in iostream.
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