This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:fall2024:projects:msi3 [2024/10/03 00:35] – [mknode() function] cburling | notes:fall2024:projects:msi3 [2024/10/03 01:38] (current) – [clearlist() function] jmerri10 | ||
---|---|---|---|
Line 19: | Line 19: | ||
=====mklist() function===== | =====mklist() function===== | ||
+ | For mklist one must name there list like they have the other struct objects in previous projects. And also just like previous projects one must allocate memory for said list! Or else there will be issues in your future! In typical faction one must set their lists attributes to **NULL**.\\ | ||
+ | Don't forget that this is a non void function, meaning that it needs to **return a value**! | ||
=====insert() function===== | =====insert() function===== | ||
The insert function should operate a bit like the append function. However, this time it should allow a node to be placed wherever in the last as opposed to strictly the end. If desired, insert could be used like obtain(). | The insert function should operate a bit like the append function. However, this time it should allow a node to be placed wherever in the last as opposed to strictly the end. If desired, insert could be used like obtain(). | ||
Line 37: | Line 38: | ||
Don't forget that since this is a function it needs a return value! | Don't forget that since this is a function it needs a return value! | ||
=====obtain() function===== | =====obtain() function===== | ||
+ | For the most part, the obtain() function should be the same as the obtain() function in msi2. Loop through your list until you find the node you would like to obtain, then return the list. | ||
=====clearlist() function===== | =====clearlist() function===== | ||
+ | The clearlist() function should be the same as in msi2, as well. Loop through your list and remove each node in the list using your rmnode() function until the list reaches NULL (end of list). Make sure the list's start and end is NULL, then return the list. | ||
=====rmlist() function===== | =====rmlist() function===== | ||
The rmlist function will call clearlist() function. After the list is successfully cleared, then the list itself will be deallocated from memory. | The rmlist function will call clearlist() function. After the list is successfully cleared, then the list itself will be deallocated from memory. |