Yes, local variables declared in fred remain on the stack while inside
mary.
But while inside mary (which is really just another call of fred), I
am creating new nodes which I would like to persist even after mary is
finished (and even after fred is finished in fact)... I think I'm on
an entirely different train because every which way I attempt to think
about it, I'm always lead to the "heap"
Post by Ashif HarjiNo, preallocating the nodes is not allowed.
Let me give you a hint. Say you are in routine fred and you call routine
mary. Do the local variables you declared in fred remain on the stack
while you are in mary?
ashif
Post by achowAm I allowed to decide on a predetermined maximum number of includes
(say, a million...?) and create all those nodes with empty fileName in
the main() routine?
Post by achowYeah, I must be missing something....if I want the node(s) that
was(were) created in that particular recursive call of processOneFile
to persist, it feels like I would need to create the nodes on the
heap......
Anyone have any ideas?
Post by kun qianfrom the assignment it says "...Otherwise, push the file name on the
stack, open it, and begin
processing it. ..." I don't see how processOneFIle would not need a
push routine that allocated memory. Am I misunderstanding something?