You are required to write a program for handling array lists, which consists of array list.c, which should contain
all of your function implementations, and array list.h, which should contain your structure definition, any necessary
typedefs, and all of your forward function declarations. When you compile, you will need to include the source file
in your command in order to ensure the functions exist during the linking process. You may include any additional
helper functions as you see fit, although they will likely not be necessary. Since you are dealing with pointers, you
will need to check all of your pointers to ensure they are not null. Trying to perform operations on null will lead to
segmentation faults or other program crashes at run-time.
Your array list will hold a specific data type (and that data type only) as defined by the initialization parameters.
The size of the data type held is provided, as is the name. Each element stored in the array list should be of the
given size in bytes. For example, if your array list is initialized as an int array list, then the item size will be 4 and
the type name will be ”int”.
Your array list will also be given a starting size value in the initialization parameters. This value should be used as
the starting maximum size for your array list, which is necessary for allocating the initial memory block. The default
value for the starting size is 10.
The details of the array list functionality are described in the Array Lists section of this document. The bool type
referenced in this contract is found in <stdbool.h>. You are expected to do basic error checking (such as checking
for null pointers and correct index boundaries).
Your array list program must include the following struct (typedef-ed appropriately):


0 comments