left operand must be l-value?

Started by
12 comments, last by peter86 21 years, 6 months ago
Have you been talking to my doctor?!
He has called me crazy but never insane.

Yes this would be a very bad idea!!!
. array = anyTypeInTheWorldYouCanThinkOf; // error

You can''t assign anything to a C array, period. Huh????

I always thought you could assign an address to a pointer. (like using new perhaps)

I used ''whatever'' as a generic variable/r-value name only and was not trying to indicate that you could/should assign any value you liked into a pointer. So, I''m sorry for the confusion.

And, yes you''re right to copy data from one array to another. Because, having two or more different pointers that can manipulate the same data at the same time could cause confusion which may introduce hard to track bugs.

However, I do like to pass some arguements by reference instead of by value. (like bitmaps, strings, etc...) So I''ll continue to assign addresses to pointers to pass large data in a method. Well, until the C++ standard considers that to dangerous and bans that from the language.

Besides, I was trying to point out that you can not use a class definition in your program as an object because it''s not an object. I see it more like a structure definition with methods.

Again, Sorry for the insane confusion!!!

NO, I''m not insane! (Crazy...Damn It)
Advertisement
Ok, yeah an array is not an l-value. Sorry, (all that talk of pointers was a little useless in this case) I got a little pointer insane.

P.S. I wonder how many others have confused arrays with pointers??




[edited by - CodeJunkie on October 5, 2002 4:39:54 AM]
Why not make them pointers instead of arrays?

And seeing that you''ve created a class.... Why not overload your = operator to support assigning those values to each other?

Just a thought.


--------------Silver_Serpent
its a string. use string then.. :D

else strncpy is what you need to assign the data..

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

This topic is closed to new replies.

Advertisement