Field Not a Modifiable Lvalue.

So I am making a class that can be named and display its name using a char array (don't ask me why I'm not using a string), and I'm being told that name is not a modifiable lvalue. I can't think of any reason why this would happen. Here are some code snippets from my class definition.

1
2
3
4
5
6
7
8
9
10
  char name[]; //This is private

  /*
   * Later, in the source file.
   */
  
  void ClassName::setName(char n[]) {
      name = n; //This, among other places where I must assign name, is where I
                //encounter the error.
  }


I should mention that name seems to be the only variable that gives me this problem.
Last edited on
Topic archived. No new replies allowed.