1. C/C++
Create a inked list of up to 20 peripherals.
Hold data about peripheral in a structure.
Provide for adding new peripherals, finding and removing them.
Minimize code by leveraging code reuse.
struct peripheral
{
struct peripheral *next;
char *name;
char *description;
}
#define new(a) malloc(sizeof(struct a));
#define MAX_P 20;
int total = 0;
main
{
struct peripherial *root;
root = malloc(sizeof(struct peripheral));
(*root).next, or
root->next = new(peripheral);
root->name = “keyboard”;
root->next-> = “mouse”;
// find the mouse peripheral
struct peripherial *mouse = findByNameLast(root,”mouse”)->next; // ->next =’s findByName;