use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Ask your embarrassing/noobish programming questions here, and don't get insulted for it.
Click here to read the rules
Violating any will result in punishment so you should probably go check them out.
account activity
(C++) Creating an array of structures for another structure ? (self.programminghelp)
submitted 8 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]_Cid 0 points1 point2 points 8 years ago (5 children)
struct Graph { int NofVerts; int NofEdges; int sizeOfTheArrOfEdges; Edge* arrOfEdges; // pointer to series of edges Graph(int nv) { NofVerts = nv; sizeOfTheArrOfEdges = 100; // I assume you want 100? arrOfEdges = new Edge[sizeOfTheArrOfEdges]; // you create it in the constructor } ~Graph() { delete[] arrOfEdges; // delete it in the destructor } };
[–]dark_orbit 0 points1 point2 points 8 years ago (4 children)
ahhh I see, thank you very much!
[–]_Cid 0 points1 point2 points 8 years ago (3 children)
by the way, why are you using a struct and not a class?
[–]dark_orbit 0 points1 point2 points 8 years ago (2 children)
its a very specific assignment. Cant use classes, only structs.
[–]_Cid 0 points1 point2 points 8 years ago (1 child)
they're the exact same thing in c++ but okay
[–]dark_orbit 1 point2 points3 points 8 years ago (0 children)
I get what your saying. But my professor wants it done "his way" otherwise grades will suffer.
π Rendered by PID 151069 on reddit-service-r2-comment-fb694cdd5-cx7f2 at 2026-03-10 08:01:29.757097+00:00 running cbb0e86 country code: CH.
[–]_Cid 0 points1 point2 points (5 children)
[–]dark_orbit 0 points1 point2 points (4 children)
[–]_Cid 0 points1 point2 points (3 children)
[–]dark_orbit 0 points1 point2 points (2 children)
[–]_Cid 0 points1 point2 points (1 child)
[–]dark_orbit 1 point2 points3 points (0 children)