there are two types for initializing string
constant pointer char p[]="quest"
pointer to constant char *p="quest"
i have read in a book that we cannot change value that pointer is pointing to,in pointer to constant so *p='M' should be invalid. but following code compiles.why?
#include <stdio.h>
int main(void) {
#include<stdio.h>
int main()
{
char *p="quest";
*p='M';
getchar();
return 0;
}
link to program-http://ideone.com/YsJ1t9