Home › Forums › C Programming › pointer of array of class › Reply To: pointer of array of class
April 5, 2008 at 1:05 pm
#3375
Humayan
Participant
You want to return the newly copied array from the function “AddGrade” ? If so change your parameters to :
1 2 3 4 5 6 7 8 9 10 | void AddGrade ( Grade **& _numGrades , int & _students )<br /> {<br /> Grade ** gradeTemp = new Grade * [ _students + 1 ];<br /> <br /> for( int i = 0 ; i < _students + 1 ; i ++ )<br /> gradeTemp [ i ] = _numGrades [ i ] ;<br /> _students ++;<br /> //add code here to delete old "_numGrades" <br /> _numGrades = gradeTemp;<br /> } |