Question: struct color in c programming. 2) Let color be the following structure: struct color int red; int green int blue; Write functions for question a)

struct color in c programming. struct color in c programming. 2) Let color be the following structure:

2) Let color be the following structure: struct color int red; int green int blue; Write functions for question a) to f) a) struct color make_color (int red, int green, int blue); Return a color structure containing the specified red, green, and blue values. If any argument is less than zero, the corresponding member of the structure will contain zero instead. If any argument is greater than 255, the corresponding member of the structure will contain 255. b) int getRed (struct color c) Returms the value of c's red member c) bool equal_color (struct color colorl, struct color color2) Returns true if the corresponding members of color1 and color2 are equal. (Note: please typedef int as bool, and define true and false as Macros) d) struct color brighter (struct color c) Returns a color structure that represents a brighter version of the color c. The structure is identical to c, except that each member has been divided by 0.7 (with the result truncated to an integer). However, there are three special cases: (1) If all members of c are zero, the function returms a color whose members all have the value 3. (2) Ifany member of c is greater than 0 but less than 3, it is replaced by 3 before the division by 0.7. (3) If dividing by 0.7 causes a member to exceed 255, it is reduced to 255. e) struct color darker (struct color c) Returns a color structure that represents a darker version of the color c. The structure is identical to c, except that each member has been multiplied by 0.7 (with the result truncated to an integer). f) void reset (struct color p) Reset the red, green and blue member to 0 of the color by using a pointer pointing to it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!