Hello,
I am attempting to use a dynamic array with a structure to assign a string to a value in the structure (I appologize for the bad wording, I haven't been programing in C++ for very long), however, I get an error when I try to compile the program.
The error(s) are:
Lvalue required in function main()
Pointer to structure required on left side of -> or ->* in function main()
and again:
Lvalue required in function main()
That gives me the same error as the other two:
Lvalue required in function main()
If it would help, I can post my entire program, those are only parts of it, by the compiler says that everything else is fine.
When you declare an array, you need to tell it how many elements it has. Also, you cannot assign a value to an array of characters simply by saying brand = "string";
You have two options. You can change it to a pointer: char *brand;
or (I recommend this) you can use a string instead: string brand;
If you use the string, you'll need to add #include <string>
to your list of headers.