Question
int setHouse Prices(int numOfHouses); Input Parameter - an integer referring to the number of houses for which prices will be set. Dynamically allocate the memory
int setHouse Prices(int numOfHouses); Input Parameter - an integer referring to the number of houses for which prices will be set. Dynamically allocate the memory for an array to store the house prices (integers). o Go through the dynamically allocated array and initialize the values randomly in a range 100,000 to 500,000 in increm Return the pointer to the dynamically allocated array. void print HousesinPriceRange(int housePrices, int numOfHouses, int lowPrice, int highPrice); This function traverses the dynamically created array referred by the pointer housePrices and finds houses that have . After this, print the total number of houses found in the given price range. If no houses were found, print \"No houses f house.h . Header guards Prototypes for the functions int setHousePrices(int numOfHouses); void printHousesinPriceRange(int housePrices, int numOf Houses, int lowPrice, int highPrice); main.c Include all header files Main function to do the following:
Create an integer pointer to store starting address of the dynamically allocated array. Take the value for numOfHouses from the user. . Call the setHousePrices() function and pass numOfHouses. The function creates a dynamic array, sets the house pm Call the printHousesinPriceRange() function to print the houses in the range [200000,400000] o Free the dynamically allocated array and end the main function. llowing files: 100 to 500,000 in increments of 10,000 e): dfinds houses that have price within the price range [lowPrice, highPrice) and prints out the index at which that house odsts and price for those houses in the format (%dle%dla hound, print \"No houses found.\" Price: nic array, sets the house prices, and returns the pointer to that array 2000)
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