#### Archived

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

# returning pointers of class arrays

This topic is 5019 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
use return ..... LOL.

Why not use a pointer?

##### Share on other sites
CLASS_A *function (CLASS_A *varA, CLASS_B *varB) {...return varA ;}