{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exam 2 Page 5

# Exam 2 Page 5 - 4 Code writing[10 points each i 20 total A...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4. Code writing [10 points each i 20 total]. A. Fill in the function named strdupe that uses dynamic storage allocation to create a duplicate copy of a string. For example, the call 9 "—“ strdnpe (sir); would allocate space for a new copy of str of the same length, and then copy of the contents of str into the new space, and then return a pointer to that. Have it return a NULL pointer if the memory allocation fails. i) x.“ char *strdupe (const char *5) :3 3‘3? A; { mmﬁkkwj 7‘" é?‘ 1/ Km}?- 52.2w; MJMMJM @0ij } A _ ‘x m. XV}? Struct P011112 4. . \M { double X; a. e double y; “a .5- \a,/ % }; on Complete the distance function below that returns the distance between V two given Points (use the normal method for computing distance). double distance€Point start, Point: end) { M124. Mra‘iitIU/‘b ‘ made: 51mg? ‘TQM‘E' [O r «‘f‘émrta O‘)_ _‘ mm = W0“ 3% ‘56 WM: : 5W7 «- M33” ('14 (V617L<QJ - Viz/1% ..~ ,, ‘9 “I ‘9 75" >3 . ﬁnite be {e the; t” w } “£9119: Via}; g MW ‘ , hoﬁﬁ :— §@{(~T(h0{t'z+¢e{ﬂ I _ . J Page6 Item/W. ”£45 2’“ 7‘ ...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern