How come that output of following programm is "pankaj", I was expecting a compilation error like "can not modify a constant string"
#include<iostream>
using namespace std;
void fun(const char *a)
{
a = "pankaj";
cout << a;
}
int main()
{
const char *ptr = "GeeksforGeeks";
fun(ptr);
return 0;
}