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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started