conversion from const char* to char*

#include<iostream>
using namespace std;
#include<string.h>


int main()
{
char*a="Venkat";
cout<<a;
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.
char*a="venkat"

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.
@Peter87
Thanks for the clarification.

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