Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Question 3 9 marks In two labs , you developed a C module that implements a list collection . It used a struct and a dynamically allocated array as...

The programming language is C. I have written the answer but we don't have the correct answer from professor, could you please give the answer?

Question 3 9 marksIn two labs , you developed a C module that implements a list collection . It used a struct and adynamically allocated array as the underlying data structure . Here is the declaration of the list's " typetypedef structintelemsPoints to the list's backing arrayintcapacity ; / Maximum number of elements in the listintsizeCurrent number of elements in the listintlistA function named intlist take takes two arguments a pointer to a list and an integerint * intlist take ( intlist ( $ list , int n )This function returns a pointer to a new array ( not a list ) that has room for exactly in integers . Thefunction removes the first in elements from the list , and stores them in the new arrayFor example , suppose parameter list points to a list containing 3 2 5 7 8 2 ) and parameter n equals4 . The function will return a new array containing 3 2 5 , 7) The list now contains 8 2The function must terminate ( via assert ) if it is passed a NULL pointer or if n is nonpositive or if thelist contains fewer than in elementsYour intlist take function can call functions from the C standard library ( see the crib sheet at theend of this question paper ) however , it cannot call any functions from the list module you developed inthe labs e g . intlist construct , intlist append , etcComplete the definition of int list takeint * intlist take ( intlist * * list , int n )
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question