Author: Stan Eisenstat
Subject: Re: [Cs223] unsure about createD()
Date: Thursday, 19 Mar 2020, 08:08:12
> Message Posted By: Unknown > > My plan currently is to have a struct stack, and then in my deque struct, > have two stacks. I'm confused about what exactly I need to do in > createD() -- I understand (I think) that we're supposed to malloc space > for *d, the pointer to a Deque that's passed into the function, but I'm > unsure of what to do beyond that. Should I set my H and T stacks to > NULL/0? Do I need to do that, or are they automatically initialized to 0? You need to initialize the space you malloc()-ed to represent the fact that the two stacks are empty. malloc() does not initialize the storage that it allocates. --Stan-PREV INDEX NEXT