S
saurabh
Please have a look at following snippet..
#include<stdio.h>
int main()
{
char* a="foo";
char * b="bar";
*a=*b;
/* I know above line has undefined behaviour,because *a and *b are
read only ,my question is why?I understand that a and b are locals and
will be allocated on main's stack frame.Then why can't I modify them
*/
return 0;
}
#include<stdio.h>
int main()
{
char* a="foo";
char * b="bar";
*a=*b;
/* I know above line has undefined behaviour,because *a and *b are
read only ,my question is why?I understand that a and b are locals and
will be allocated on main's stack frame.Then why can't I modify them
*/
return 0;
}