Homework Solution: In C language I need to add some functions to the program….

    In C language I need to add some functions to the program. These are the functions you need to add. * You do not need to change anything in main.c file, you just need to add these functions in lab2.h file. int removeItem(int index, List userList) – This function removes the item at location index from userList. If there isn’t an item at that location the function just returns an error code. Note that you are free to decide what error code is returned but you must provide appropriate documentation (comments) for the user. List appendList(List uList1, List uList2) – This function creates a new list consisting of the items on list uList1 followed by the items on list uList2. Note that this function can’t inform the user if malloc fails, so your documentation needs to warn about that. List mergeList(List uList1, List uList2) – This function creates a new list consisting of the items on list uList1 followed by the items on list uList2 but with duplicates removed. Note that this function can’t inform the user if malloc fails, so your documentation needs to warn about that. (code below is the lab2.h file) #include <stdio.h> #include <stdlib.h> typedef struct listnode { int maxSizeOfList, tail; float *array; } List; int createList(List*, int); int addItem(float, List*); // work on this float getItem(int, List); int sizeOfList(List); void deleteList(List*); float deleteItem(int, List*); // work on this int appendLists(List, List, List*); // you could save it for next week int createList(List *listPtr,int List_size){ // return 0 if error, return 1 is successful listPtr->maxSizeOfList = List_size; listPtr->tail = 0; listPtr->array = malloc(sizeof(float)*List_size); if (listPtr->array == NULL){ return 0; } return 1; } int addItem(float new_number, List* myList){ if (myList->tail < myList->maxSizeOfList){ myList->array[myList->tail] = new_number; myList->tail ++; return 1; } else { float temparray[myList->maxSizeOfList]; for (size_t i = 0; i < myList->maxSizeOfList; i++){ temparray[i] = myList->array[i]; } myList->array = malloc(sizeof(float)*myList->maxSizeOfList*2); if (myList == NULL){ return 0; } for (size_t i = 0; i < myList->maxSizeOfList; i++){ myList->array[i] = temparray[i]; } myList->array[myList->tail] = new_number; myList->tail ++; myList->maxSizeOfList = myList->maxSizeOfList * 2; return 1; } } float getItem(int index,List userList){ if (index > userList.tail){ return 0.0; } return userList.array[index]; } int sizeOfList(List userList){ return userList.tail; } void deleteList(List *userListPtr){ userListPtr->tail = 0; free(userListPtr->array); userListPtr->array = NULL; } float deleteItem(int index, List* myList){ if (index >= myList->tail){ return 0.0; } else { float returnValue = myList->array[index]; for (size_t i = index; i < myList->tail-1; i++){ myList->array[i] = myList->array[i+1]; } myList->tail --; return returnValue; } } (code below is the main.c file.) #include "lab2.h" int main(void) { int List_size = 2; // the size of an array List My_List; // the list you will use if (createList(&My_List,List_size) == 0){ return 0; } printf("nSize of an array is %d, and it's empty.nn",sizeOfList(My_List)); // add the first item int add1 = addItem(1.11,&My_List); if (add1 == 0) { printf("Adding first item failed.n"); return 0; } else { printf("Adding first item succeeded.n"); // print the list printf("Size of an array is %d, and its elements are: ",sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); } // add second item int add2 = addItem(2.22,&My_List); if (add2 == 0) { printf("Adding second item failed.n"); return 0; } else { printf("Adding second item succeeded.n"); // print the list printf("Size of array is %d, and its elements are: ",sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); } // add third item int add3 = addItem(3.33,&My_List); if (add3 == 0){ printf("Adding third item failed.n"); return 0; } else { printf("Adding third item succeeded.n"); // print the list printf("Size of array is %d, and its elements are: ",sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); } // delete the second item int delete_index = 1; printf("Delete second item.n"); float removedItem = deleteItem(delete_index, &My_List); printf("%.2f is deleted.nSize of the new array is %d, and its elements are: ",removedItem,sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); // delete an index that doesn't exist delete_index = 3; if (deleteItem(delete_index, &My_List) == 0.00) { printf("Trying to delete element at index %d; however, the index is not found.nn", delete_index); } /* // creating a different list with 5 elements List List2; if (createList(&List2,5) != 0){ for (size_t i = 0; i < 5; i++){ List2.array[i] = 1.5; // just make an array [1.5 1.5 1.5 1.5 1.5] List2.tail = 5; List2.maxSizeOfList = 5; } } // append both lists List appended_List; int check_append = appendLists(My_List, List2, &appended_List); if( check_append == 0){ printf("Append Failed.n"); } else { // display the appended array printf("Size of the appended array is %d, and its elements are: ",sizeOfList(appended_List)); for (size_t i = 0; i < appended_List.tail; i++){ printf("%.2f ",getItem(i,appended_List)); } } printf("nn"); deleteList(&appended_List); // free the appended array as well */ deleteList(&My_List); // free array printf("End of Program. Have a fabulous day!n"); return 1; } #include "lab2.h" int main(void) { int List_size = 2; // the size of an array List My_List; // the list you will use if (createList(&My_List,List_size) == 0){ return 0; } printf("nSize of an array is %d, and it's empty.nn",sizeOfList(My_List)); // add the first item int add1 = addItem(1.11,&My_List); if (add1 == 0) { printf("Adding first item failed.n"); return 0; } else { printf("Adding first item succeeded.n"); // print the list printf("Size of an array is %d, and its elements are: ",sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); } // add second item int add2 = addItem(2.22,&My_List); if (add2 == 0) { printf("Adding second item failed.n"); return 0; } else { printf("Adding second item succeeded.n"); // print the list printf("Size of array is %d, and its elements are: ",sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); } // add third item int add3 = addItem(3.33,&My_List); if (add3 == 0){ printf("Adding third item failed.n"); return 0; } else { printf("Adding third item succeeded.n"); // print the list printf("Size of array is %d, and its elements are: ",sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); } // delete the second item int delete_index = 1; printf("Delete second item.n"); float removedItem = deleteItem(delete_index, &My_List); printf("%.2f is deleted.nSize of the new array is %d, and its elements are: ",removedItem,sizeOfList(My_List)); for (size_t i = 0; i < My_List.tail; i++){ printf("%.2f ",getItem(i,My_List)); } printf("nn"); // delete an index that doesn't exist delete_index = 3; if (deleteItem(delete_index, &My_List) == 0.00) { printf("Trying to delete element at index %d; however, the index is not found.nn", delete_index); } /* // creating a different list with 5 elements List List2; if (createList(&List2,5) != 0){ for (size_t i = 0; i < 5; i++){ List2.array[i] = 1.5; // just make an array [1.5 1.5 1.5 1.5 1.5] List2.tail = 5; List2.maxSizeOfList = 5; } } // append both lists List appended_List; int check_append = appendLists(My_List, List2, &appended_List); if( check_append == 0){ printf("Append Failed.n"); } else { // display the appended array printf("Size of the appended array is %d, and its elements are: ",sizeOfList(appended_List)); for (size_t i = 0; i < appended_List.tail; i++){ printf("%.2f ",getItem(i,appended_List)); } } printf("nn"); deleteList(&appended_List); // free the appended array as well */ deleteList(&My_List); // free array printf("End of Program. Have a fabulous day!n"); return 1; }

    Expert Answer

     
    Sample Code: listMain.c #include "lab2.h" int main(void) { int List_size = 2; // the size of an array

    In C speech I want to supplement some characters to the program.

    These are the characters you want to supplement. * You do referable attributable attributable attributable want to diversify anything in ocean.c refine, you reasonable want to supplement these characters in lab2.h refine.

    int transportItem(int refutation, Catalogue userList) – This character transports the ace at colony refutation from userList. If there isn’t an ace at that colony the character reasonable profits an falsity sequence. Referable attributable attributablee that you are untrammelled to determine what falsity sequence is recompenseed excepting you must supply alienate documentation (comments) ce the user.

    Catalogue supplementList(Catalogue uList1, Catalogue uList2) – This character creates a upstart catalogue consisting of the aces on catalogue uList1 followed by the aces on catalogue uList2. Referable attributable attributablee that this character can’t referableify the user if malloc fails, so your documentation wants to dissuade encircling that.

    Catalogue mergeList(Catalogue uList1, Catalogue uList2) – This character creates a upstart catalogue consisting of the aces on catalogue uList1 followed by the aces on catalogue uList2 excepting with duplicates transportd. Referable attributable attributablee that this character can’t referableify the user if malloc fails, so your documentation wants to dissuade encircling that.

    (sequence adown is the lab2.h refine)

    #include <stdio.h>
    #include <stdlib.h>

    typedef struct cataloguenode {
    int maxSizeOfList, subordinate;
    bear *array;
    } Catalogue;

    int createList(List*, int);
    int supplementItem(float, Catalogue*); // fruit on this
    bear getItem(int, Catalogue);
    int magnitudeOfList(List);
    space deleteList(List*);
    bear deleteItem(int, Catalogue*); // fruit on this
    int supplementLists(List, Catalogue, Catalogue*); // you could husband it ce proximate week

    int createList(Catalogue *listPtr,int Catalogue_size){
    // recompense 0 if falsity, recompense 1 is successful

    listPtr->maxSizeOfCatalogue = Catalogue_size;
    listPtr->subordinate = 0;
    listPtr->equip = malloc(sizeof(float)*List_size);

    if (listPtr->equip == NULL){
    recompense 0;
    }
    recompense 1;

    }

    int supplementItem(bear upstart_number, Catalogue* myList){
    if (myList->subordinate < myList->maxSizeOfList){
    myList->array[myList->tail] = upstart_number;
    myList->subordinate ++;
    recompense 1;
    }
    else {
    bear temparray[myList->maxSizeOfList];
    ce (size_t i = 0; i < myList->maxSizeOfList; i++){
    temparray[i] = myList->array[i];
    }
    myList->equip = malloc(sizeof(float)*myList->maxSizeOfList*2);
    if (myCatalogue == NULL){
    recompense 0;
    }
    ce (size_t i = 0; i < myList->maxSizeOfList; i++){
    myList->array[i] = temparray[i];
    }
    myList->array[myList->tail] = upstart_number;
    myList->subordinate ++;
    myList->maxSizeOfCatalogue = myList->maxSizeOfCatalogue * 2;
    recompense 1;
    }

    }

    bear getItem(int refutation,Catalogue userList){

    if (refutation > userList.tail){
    recompense 0.0;
    }

    recompense userList.array[index];

    }

    int magnitudeOfList(Catalogue userList){

    recompense userList.tail;

    }

    space deleteList(Catalogue *userListPtr){

    userListPtr->subordinate = 0;
    free(userListPtr->array);
    userListPtr->equip = NULL;

    }

    bear deleteItem(int refutation, Catalogue* myList){
    if (refutation >= myList->tail){
    recompense 0.0;
    }
    else {
    bear recompenseValue = myList->array[index];
    ce (size_t i = refutation; i < myList->tail-1; i++){
    myList->array[i] = myList->array[i+1];
    }
    myList->subordinate –;
    recompense recompenseValue;
    }

    }

    (sequence adown is the ocean.c refine.)

    #include “lab2.h”

    int ocean(void) {
    int Catalogue_magnitude = 2; // the magnitude of an equip

    Catalogue My_List; // the catalogue you gain use
    if (createList(&My_List,List_size) == 0){
    recompense 0;
    }

    printf(“nMagnitude of an equip is %d, and it’s space.nn”,sizeOfList(My_List));

    // supplement the chief ace
    int supplement1 = supplementItem(1.11,&My_List);
    if (add1 == 0) {
    printf(“Adding chief ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding chief ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of an equip is %d, and its atoms are: “,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // supplement remedy ace
    int supplement2 = supplementItem(2.22,&My_List);
    if (add2 == 0) {
    printf(“Adding remedy ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding remedy ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of equip is %d, and its atoms are: “,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // supplement third ace
    int supplement3 = supplementItem(3.33,&My_List);
    if (add3 == 0){
    printf(“Adding third ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding third ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of equip is %d, and its atoms are: “,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // delete the remedy ace
    int delete_refutation = 1;
    printf(“Delete remedy ace.n”);

    bear transportdAce = deleteItem(delete_index, &My_List);

    printf(“%.2f is deleted.nMagnitude of the upstart equip is %d, and its atoms are: “,removedItem,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);

    // delete an refutation that doesn’t exist
    delete_refutation = 3;
    if (deleteItem(delete_index, &My_List) == 0.00) {
    printf(“Trying to delete atom at refutation %d; ultimately, the refutation is referable attributable attributable attributable endow.nn”, delete_index);
    }

    /*
    // creating a irrelative catalogue with 5 atoms
    Catalogue Catalogue2;

    if (createList(&List2,5) != 0){
    ce (size_t i = 0; i < 5; i++){
    List2.array[i] = 1.5; // reasonable create an equip [1.5 1.5 1.5 1.5 1.5]
    List2.subordinate = 5;
    List2.maxSizeOfCatalogue = 5;
    }
    }

    // supplement twain catalogues
    Catalogue supplemented_List;

    int check_supplement = supplementLists(My_List, Catalogue2, &appended_List);

    if( check_supplement == 0){
    printf(“Supplement Failed.n”);
    }
    else {
    // vault the supplemented equip
    printf(“Magnitude of the supplemented equip is %d, and its atoms are: “,sizeOfList(appended_List));
    ce (size_t i = 0; i < supplemented_List.tail; i++){
    printf(“%.2f “,getItem(i,appended_List));
    }
    }
    printf(“nn”);

    deleteList(&appended_List); // untrammelled the supplemented equip as well
    */

    deleteList(&My_List); // untrammelled equip
    printf(“End of Program. Have a feigned day!n”);

    recompense 1;
    }

    #include “lab2.h”

    int ocean(void) {
    int Catalogue_magnitude = 2; // the magnitude of an equip

    Catalogue My_List; // the catalogue you gain use
    if (createList(&My_List,List_size) == 0){
    recompense 0;
    }

    printf(“nMagnitude of an equip is %d, and it’s space.nn”,sizeOfList(My_List));

    // supplement the chief ace
    int supplement1 = supplementItem(1.11,&My_List);
    if (add1 == 0) {
    printf(“Adding chief ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding chief ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of an equip is %d, and its atoms are: “,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // supplement remedy ace
    int supplement2 = supplementItem(2.22,&My_List);
    if (add2 == 0) {
    printf(“Adding remedy ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding remedy ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of equip is %d, and its atoms are: “,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // supplement third ace
    int supplement3 = supplementItem(3.33,&My_List);
    if (add3 == 0){
    printf(“Adding third ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding third ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of equip is %d, and its atoms are: “,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // delete the remedy ace
    int delete_refutation = 1;
    printf(“Delete remedy ace.n”);

    bear transportdAce = deleteItem(delete_index, &My_List);

    printf(“%.2f is deleted.nMagnitude of the upstart equip is %d, and its atoms are: “,removedItem,sizeOfList(My_List));

    ce (size_t i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);

    // delete an refutation that doesn’t exist
    delete_refutation = 3;
    if (deleteItem(delete_index, &My_List) == 0.00) {
    printf(“Trying to delete atom at refutation %d; ultimately, the refutation is referable attributable attributable attributable endow.nn”, delete_index);
    }

    /*
    // creating a irrelative catalogue with 5 atoms
    Catalogue Catalogue2;

    if (createList(&List2,5) != 0){
    ce (size_t i = 0; i < 5; i++){
    List2.array[i] = 1.5; // reasonable create an equip [1.5 1.5 1.5 1.5 1.5]
    List2.subordinate = 5;
    List2.maxSizeOfCatalogue = 5;
    }
    }

    // supplement twain catalogues
    Catalogue supplemented_List;

    int check_supplement = supplementLists(My_List, Catalogue2, &appended_List);

    if( check_supplement == 0){
    printf(“Supplement Failed.n”);
    }
    else {
    // vault the supplemented equip
    printf(“Magnitude of the supplemented equip is %d, and its atoms are: “,sizeOfList(appended_List));
    ce (size_t i = 0; i < supplemented_List.tail; i++){
    printf(“%.2f “,getItem(i,appended_List));
    }
    }
    printf(“nn”);

    deleteList(&appended_List); // untrammelled the supplemented equip as well
    */

    deleteList(&My_List); // untrammelled equip
    printf(“End of Program. Have a feigned day!n”);

    recompense 1;
    }

    Expert Counterpart

     

    Sample Sequence:

    listMain.c

    #include “lab2.h”

    int ocean(void) {
    int Catalogue_magnitude = 2; // the magnitude of an equip

    Catalogue My_List; // the catalogue you gain use
    if (createList(&My_List,List_size) == 0){
    recompense 0;
    }

    printf(“nMagnitude of an equip is %d, and it’s space.nn”,sizeOfList(My_List));

    // supplement the chief ace
    int supplement1 = supplementItem(1.11,&My_List);
    if (add1 == 0) {
    printf(“Adding chief ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding chief ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of an equip is %d, and its atoms are: “,sizeOfList(My_List));
    size_t i;
    ce (i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // supplement remedy ace
    int supplement2 = supplementItem(2.22,&My_List);
    if (add2 == 0) {
    printf(“Adding remedy ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding remedy ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of equip is %d, and its atoms are: “,sizeOfList(My_List));
    size_t i;
    ce (i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    // supplement third ace
    int supplement3 = supplementItem(3.33,&My_List);
    if (add3 == 0){
    printf(“Adding third ace failed.n”);
    recompense 0;
    }
    else {
    printf(“Adding third ace succeeded.n”);

    // stereotype the catalogue
    printf(“Magnitude of equip is %d, and its atoms are: “,sizeOfList(My_List));
    size_t i;
    ce (i = 0; i < My_List.tail; i++){
    printf(“%.2f “,getItem(i,My_List));
    }
    printf(“nn”);
    }

    /**** Start Transport an Ace ***/
    int transport_ace = 12;
    int foothold = transportItem(remove_item, &My_List);
    if(status)
    printf(“Removed ace successfully!”);
    else
    printf(“Ace referable attributable attributable attributable endow!”);
    printf(“nn”);
    /**** End Transport an Ace ***/

    /**** Start Supplement 2 catalogue ***/
    // creating a irrelative catalogue with 5 atoms
    Catalogue Catalogue2;

    if (createList(&List2,5) != 0){
    size_t i;
    ce (i = 0; i < 5; i++){
    List2.array[i] = 1.5; // reasonable create an equip [1.5 1.5 1.5 1.5 1.5]
    List2.subordinate = 5;
    List2.maxSizeOfCatalogue = 5;
    }
    }

    // supplement twain catalogues
    Catalogue supplemented_List;
    appended_Catalogue = supplementLists(&My_List, &List2);

    if( supplemented_List.maxSizeOfCatalogue == 0){
    printf(“Supplement Failed.n”);
    }
    else {
    // vault the supplemented equip
    printf(“Magnitude of the supplemented equip is %d, and its atoms are: “,sizeOfList(appended_List));
    size_t i;
    ce (i = 0; i < supplemented_List.tail; i++){
    printf(“%.2f “,getItem(i,appended_List));
    }
    }
    printf(“nn”);
    deleteList(&appended_List); // untrammelled the supplemented equip as well
    /**** End Supplement 2 catalogue ***/

    /**** Start Merge 2 catalogue ***/
    Catalogue mergedList;
    mergedCatalogue = mergeList(&My_List, &List2);
    if( mergedList.maxSizeOfCatalogue == 0){
    printf(“Supplement Failed.n”);
    }
    else {
    // vault the supplemented equip
    printf(“Magnitude of the merged equip is %d, and its atoms are: “,sizeOfList(mergedList));
    size_t i;
    ce (i = 0; i < mergedList.tail; i++){
    printf(“%.2f “,getItem(i,mergedList));
    }
    }
    printf(“nn”);
    deleteList(&mergedList);
    /**** End Merge 2 catalogue ***/

    deleteList(&My_List); // untrammelled equip
    //printf(“End of Program. Have a feigned day!n”);

    recompense 1;
    }

    lab2.h

    #include <stdio.h>
    #include <stdlib.h>

    typedef struct cataloguenode {
    int maxSizeOfList, subordinate;
    bear *array;
    } Catalogue;

    int createList(List*, int);
    int supplementItem(float, Catalogue*); // fruit on this
    bear getItem(int, Catalogue);
    int magnitudeOfList(List);
    space deleteList(List*);

    Catalogue supplementLists(List*, Catalogue*); // you could husband it ce proximate week
    int transportItem(int refutation, Catalogue*);
    Catalogue mergeList(List*, Catalogue*);

    int createList(Catalogue *listPtr,int Catalogue_size){
    // recompense 0 if falsity, recompense 1 is successful

    listPtr->maxSizeOfCatalogue = Catalogue_size;
    listPtr->subordinate = 0;
    listPtr->equip = malloc(sizeof(float)*List_size);

    if (listPtr->equip == NULL){
    recompense 0;
    }
    recompense 1;

    }

    int supplementItem(bear upstart_number, Catalogue* myList){
    if (myList->subordinate < myList->maxSizeOfList){
    myList->array[myList->tail] = upstart_number;
    myList->subordinate ++;
    recompense 1;
    }
    else {
    bear temparray[myList->maxSizeOfList];
    size_t i;
    ce (i = 0; i < myList->maxSizeOfList; i++){
    temparray[i] = myList->array[i];
    }
    myList->equip = malloc(sizeof(float)*myList->maxSizeOfList*2);
    if (myCatalogue == NULL){
    recompense 0;
    }
    ce (i = 0; i < myList->maxSizeOfList; i++){
    myList->array[i] = temparray[i];
    }
    myList->array[myList->tail] = upstart_number;
    myList->subordinate ++;
    myList->maxSizeOfCatalogue = myList->maxSizeOfCatalogue * 2;
    recompense 1;
    }

    }

    bear getItem(int refutation,Catalogue userList){

    if (refutation > userList.tail){
    recompense 0.0;
    }

    recompense userList.array[index];

    }

    int magnitudeOfList(Catalogue userList){

    recompense userList.tail;

    }

    space deleteList(Catalogue *userListPtr){

    userListPtr->subordinate = 0;
    free(userListPtr->array);
    userListPtr->equip = NULL;

    }

    /*
    * To transport the ace at colony refutation from userList
    */
    int transportItem(int refutation, Catalogue* userList){
    if (refutation >= userList->tail){
    recompense 0; //– If there is no ace at this colony then recompense 0 as a falsity sequence
    }
    else {
    //bear recompenseValue = userList->array[index];
    size_t i;
    ce (i = refutation; i < userList->tail-1; i++){
    userList->array[i] = userList->array[i+1];
    }
    userList->subordinate –;
    recompense 1; //– Recompense 1 if an ace endow and transportd.
    }

    }

    /*
    * To creates a upstart catalogue consisting of the aces on catalogue uList1 followed by the aces on catalogue uList2
    */
    Catalogue supplementLists(List* uList1 , Catalogue* uList2){
    Catalogue supplementList;
    int magnitude_val = uList1->subordinate + uList2->tail;
    size_t i, j;
    int stat = createList(&appendList, magnitude_val);
    if(stat){
    ce (i = 0; i < uList1->tail; i++){
    appendList.array[i] = uList1->array[i];
    appendList.subordinate ++;
    }
    i = supplementList.tail;
    ce (j = 0; j < uList2->tail; j++){
    appendList.array[i] = uList2->array[j];
    appendList.subordinate ++;
    i++;
    }
    }

    recompense supplementList;
    }

    /*
    * To creates a upstart catalogue consisting of the aces on catalogue uList1 followed by the aces on catalogue uList2
    * Without duplicates
    */
    Catalogue mergeList(List* uList1, Catalogue* uList2){
    Catalogue mergeLists;
    mergeLists = supplementLists(uList1, uList2);
    size_t i, j, k;
    for(i=0; i < mergeLists.tail; i++)
    {
    for(j=i+1; j < mergeLists.tail; )
    {
    if(mergeLists.array[j] == mergeLists.array[i])
    {
    for(k=j; k < mergeLists.tail;k++)
    {
    mergeLists.array[k] = mergeLists.array[k+1];
    }
    mergeLists.tail–;
    }
    else {
    j++;
    }
    }
    }
    recompense mergeLists;
    }

    Sample output: