Can anyone tell me :
1.
void main()
{
char temp[] = "Hello";
temp[0]='K';
}
2.
void main()
{
char* temp = "Hello";
temp[0]='K';
}
1st one gives an access violation whereas second one is done
successfully. I want to know why the fist one gives a runtime-error? I
want to know what happens internally? How the compiler interprets this
two snippets?
1.
void main()
{
char temp[] = "Hello";
temp[0]='K';
}
2.
void main()
{
char* temp = "Hello";
temp[0]='K';
}
1st one gives an access violation whereas second one is done
successfully. I want to know why the fist one gives a runtime-error? I
want to know what happens internally? How the compiler interprets this
two snippets?
Comment