I'm trying editing the content of location pointed by char* const
, but this doesn't work.
I'm trying to implement this question answer What is the difference between char s[] and char *s?
Exactly this part:
char* const
is an immutable pointer (it cannot point to any other location) but the contents of location at which it points is mutable.
I know about literal string which is immutable, but here I'm using const
so may this be different.
Here is my code:
#include <stdio.h>
int main()
{
char* const address="mutable content";
strcpy(&address,"succeed");
printf("%s\n",address);
return 0 ;
}