
Troubles with "lvalue missing" error message
: " |>
: " |>I have the following in my program:
: " |>
: " |>struct ctype
: " |>{
: " |>..
: " |>char unit[12];
: " |>..} *head, *current;
: " |>
: " |>and then a bit later
: " |>
: " |>char* input (char*);
: " |>
: " |>..
: " |>
: " |>char* input (char *data)
: " |>{
: " |> return data; //basically that's all it does
: " |>}
: " |>
: " |>..
: " |>
: " |>and then in another function
: " |>
: " |>head->unit = input (head->unit); //this gives me a "lvalue missing" error
: " |>every time!!! The left side of the expression is obviously NOT missing!
: " |>Any ideas?
: " |>
: " The key to your dilema is the declaration of the struct member "unit".
: " It's declared as an array of characters, and you are using it like a
: " character pointer in the failing assignment. You will either need to
: " modify your data structure to use (char *) or you will need to substitute
: " a str[n]cpy for the assignment.
: " This is an example of when it doesn't pay to think of an array identifier
: " as a pointer. :)
Argh!!!! My C book said that char[] and *char are the same and demonstrated
it by char[offset] == *(char+offset) I have to rewrite a lot of the code
because of this stupid problem :(
Thanks anyways!
--
/~~~~~~~~~\ |`___________________ _______________ ___________________________
| | || Boston University |_______________|___________________________|
___________ ||.................The world is coming to an end! Please log out.|
~B~l~a~c~k~ ||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
~s~e~a~ ||Brevis oratio penetrat colos, longa potatio evacuat ciphos.
~"~"~ ||"Ya pomniu chudnoe mgnovenie "I remember the instant
~"~ || kogda peredo mnoi yavilas t'y, when you appeared to me,
~ || kak mimoletnoe videnie, as an instant's vision,
~~~~~~~~~~~~`| kak genii chistoi krasotoi" as the essence of beauty"
~~~~~~~~~~~~` Pushkin, "K***"