Reputation: 105
why I can not assign it like this:
char c1 []="Odin";
c1=c1+1;
Note that I include
#include<string.h>
Upvotes: 1
Views: 45
Reputation: 3465
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.
Upvotes: 1