why I can not assign it like this:
char c1 []="Odin";
c1=c1+1;
Note that I include
#include<string.h>
Quoting the reference for your problem:
Assignment Objects of array type cannot be modified as a whole: even though they are lvalues (e.g. an address of array can be taken), they cannot appear on the left hand side of an assignment operator:
So, since c in your code is an array object i.e. a type of an array, it cannot appear on the left-hand side of an assignment operator.
c1=c1+1;do? Do u want the string to go from"Odin"to"Pdin"? Or to remove the letterO?char c1[] = "Odin"; char* p = c1; p = p + 1;strcpy()with overlapped source and destination invokes undefined behavior.