$30
1. Photo *create photo(int id, const char *description)
Returns a dynamically-allocated Photo struct initialized based on the provided parameters. If parameter
description is not NULL, assume it points to a nul-terminated string. In this case, the function dynami
cally allocates memory to hold description’s string and sets the Photo struct’s description fifield to point
to this allocated memory. If parameter description is NULL, no memory allocation takes place and the
Photo struct’s description fifield is initialized to NULL. The function returns NULL if a memory allocation
fails. You don’t have to worry about freeing memory if any memory allocation fails (e.g., one memory
allocation is successful, but a second one fails).
2. void print photo(Photo *photo)
Prints the photo’s id and description. If the description is NULL, the message description message is
”None”. The function does nothing if the photo parameter is NULL. See the public tests for information
regarding output format.
3. void destroy photo(Photo *photo)
Deallocates all dynamically-allocated memory associated with parameter photo. The function does
nothing if parameter photo is NULL.
4. void initialize album(Album *album)
1Initializes the album size to 0. Assume this function is not called on an album that has already been
initialized. The function does nothing if parameter album is NULL.
5. void print album(const Album *album)
Prints the contents of the album. If the album has no photos, the message ”Album has no photos.” is
printed. The function does nothing if parameter album is NULL. See the public tests for information
regarding output format.
6. void destroy album(Album *album)
Deallocates all dynamically-allocated memory associated with parameter album and sets the album’s
size to 0. (The Album struct itself is not deallocated, so “clear album” may be a better name for this
function.) The function does nothing if parameter album is NULL.
7. void add photo to album(Album *album, int id, const char *description)
Appends (to the end of the array) a photo if there is space (if the album size is less than MAX ALBUM SIZE).
photo is added if a photo cannot be created. The function does nothing if parameter album is NULL or
the album has no space for the photo.
You want to look at the public tests in order to understand the functionality associated with the functions
above.
6