Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y (all floats).
1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y (all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct lint x; float y; char z;)var1 union (int x; float y; char[20] z;)var2; If float and intare stored using 4 bytes each, what is the size (in bytes) for var1? What is the size of var2? (2 pts) 3. Consider the following code. struct Triangle float side1 float side2; float side3 t1, t2; enum Boolean HFALSE, TRUE); enum Boolean isEquilateral(structTriangle triangle); a. Implement the function isEquilateral which returns enum value TRUE if the given triangle is equilateral and enum value FALSE otherwise. (2 pts) b. Assign values of your choice to member variables of t1 (1.5 pts); c. Call the function isEquilateral on triangle t1 and capture the returned value in variable result. (1 pt) d. Copy the content from t1 to t2 without having to individually copy each member. (1 pt) 4. What is the output of the following program: (1 pt) typedef struct char name[20]; int grade 1; int grade2; int finalGrade) Record
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