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 )
How it Works
It only takes a couple of minutes to fill in your details, select the type of paper you need (essay, term paper, etc.), give us all necessary information regarding your assignment.
Once we receive your request, one of our customer support representatives will contact you within 24 hours with more specific information about how much it'll cost for this particular project.
After receiving payment confirmation via PayPal or credit card – we begin working on your detailed outline, which is based on the requirements given by yourself upon ordering.
Once approved, your order is complete and will be emailed directly to the email address provided before payment was made!