Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Page of 7 ZoOM 2. Start with the following code in a file. Fill in the two empty

ID: 3904675 • Letter: P

Question

Page of 7 ZoOM 2. Start with the following code in a file. Fill in the two empty compare functions so that the items car be sorted by price and by color. Complete the main function so that it sorts the array as indicated by the print statements: #include #include?stdlib.h? #include?string.h? #define LENGTH 7 typedef struct f int id; double price; char* colar Iten; Item initItem(int _id, double price, const chan*_color) Structured Data.md 5/22/2018 Iten item- malloc(sizeof (Item)); iten->id-id; iten->price-_price; iten->color - _color; void printitem(Iten item) printf("Id : %d Price: %f Color: %s ", iten->id, item->price, item->color); void printItems (Iten items, size t size) for (int i 0; i

Explanation / Answer

int comparePriceHighLow(const void* a,const void* b){

if(a->price < b->price){

return 1;

}

return 0;

}

int compareColorAlpha(const void* a,const void* b){

if(a->color.compare( b->color)<0){

return 1;

}

return 0;

}

mainpart is not clear exactly whi is needed