Question: typedef double (*price_fn)(void* obj); typedef double (*bulk_price_fn)(void* obj, unsigned int quantity); // Compares the price of obj1 with obj2 // Returns a negative number if
typedef double (*price_fn)(void* obj); typedef double (*bulk_price_fn)(void* obj, unsigned int quantity);
// Compares the price of obj1 with obj2 // Returns a negative number if the price of obj1 is less than the price of obj2 // Returns a positive number if the price of obj1 is greater than the price of obj2 // Returns 0 if the price of obj1 is equal to the price of obj2 int compare_by_price(Object* obj1, Object* obj2) { // IMPLEMENT THIS return 0; }
// Compares the quantity of obj1 with obj2 // Returns a negative number if the quantity of obj1 is less than the quantity of obj2 // Returns a positive number if the quantity of obj1 is greater than the quantity of obj2 // Returns 0 if the quantity of obj1 is equal to the quantity of obj2 int compare_by_quantity(Object* obj1, Object* obj2) {
}
- We are not allowed to use any libraries besides the math.h
- This is C programming language
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
