Archived

This topic is now archived and is closed to further replies.

ekrax

returning pointers of class arrays

Recommended Posts

ekrax    128
wow i must be really tired and stupid right now ... cause this should be really easy but i can''t seem to get it to work and my brain hurts ... i have two classes let''s call them CLASS_A and CLASS_B and two arrays of each of these classes VAR_A is of type CLASS_A and VAR_B is of type CLASS_B each with say X number of elements (X is global). i basically want a function that takes both of these arrays and modifies one of them, and since you obviously can''t return refrences to arrays i return a pointer type of CLASS_A. so the function is something like this ... CLASS_A *function (CLASS_A varA[X], CLASS_B varB[X]) my return statement is just ... return varA; ... this function will modifiy all the elements of VarA and i want to return all of them back to VAR_A in main i call this function with this ... VAR_A = function (VAR_A, VAR_B); ... and this doesn''t work "Lvalue required" ... why? i do this type of thing with strings, but this doesnt work ... man i''m probably missing something really stupid ... thanks for any help in advance

Share this post


Link to post
Share on other sites