manichandra
Technical User
why can't we do this ??
int main()
{
char *p="MANI";;
*(p+1)='C';
*(p+2) = 'B';
*(p+3) = 'D';
printf("%s\n",p);
return 0;
}
when we can do this ..
int main()
{
char s[]="MANI";
char *p;
p=s;
*(p+1)='C';
*(p+2) = 'B';
*(p+3) = 'D';
printf("%s\n",s);
printf("%s\n",p);
return 0;
}
int main()
{
char *p="MANI";;
*(p+1)='C';
*(p+2) = 'B';
*(p+3) = 'D';
printf("%s\n",p);
return 0;
}
when we can do this ..
int main()
{
char s[]="MANI";
char *p;
p=s;
*(p+1)='C';
*(p+2) = 'B';
*(p+3) = 'D';
printf("%s\n",s);
printf("%s\n",p);
return 0;
}