conversion from const char* to char*

using namespace std;

int main()
return 0;


Hi All,
I executed above program and its working perfectly fine to my surprise.
Why compiler is not thrwoing an error as I assigned Const char* to char* in the statement.

is it expected behaviour?
I have faced these kind of errors many times earlier....why compiler is not throwing an error in this case?

Thanks in advance
It's an exception to the rule. It was fixed in C++11 but many compilers still allow this, probably for backward compatibility.
Why are you including string.h? I don't see you using anything from that header.
Thanks for the clarification.

I was writing another program related to strings and didnt erase that header when I started writing this..
Topic archived. No new replies allowed.