Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • but number of students could change the execution so, I should allocate memory dynamically. How could I do that ? instead of using student[10] ? Commented Nov 18, 2013 at 15:34
  • @mxyz You would use a pointer and allocated it using new[] (and deallocating using delete[]). If that is your requirement, the last // or in my last example would be the method you would need to use - if you are not permitted to use std::vector. Commented Nov 18, 2013 at 15:35
  • For example I have cptr[1].cId (it is unique) for specified course if I want to add students to this course how could I use stedents ? Commented Nov 18, 2013 at 15:40
  • Assuming that cptr[1] is an instance of Course, It would be something like cptr[1].students = new Student[SIZE]; cptr[1].students[0].sId = SOMEID; Commented Nov 18, 2013 at 15:56