Question
C programming 1. Declare a struct named position with integer members x, y, z. The struct is modeling a point in 3-dimensional space. 2. Write
C programming
1. Declare a struct named position with integer members x, y, z. The struct is modeling a point in 3-dimensional space. 2. Write a statement to initialize the struct to contain the coordinates (2, 5, -3).
3. Create a struct named box with members: itemnum (int), color (char * or char[25]), p (struct position), height (int), width (int), depth (int) 4. Write a statement to initialize a struct with values of 3 for itemnum, "red" for color, (1,2,3) for position, 3 for height, 2 for width, and 5 for depth.
5. Write the code to declare an array of 100 boxes. 6. Write the code to create a box at indexes 0 and 1
7. Write a function that when given two boxes, returns the one with the greater volume. Additionally, the function modifies the position and color of the biggest box. The returned box should have a position of (0, 0, 0) and the color should be "green". If both boxes have the same volume, make the modifications and return the second box.
8. Write a function that given two pointers to box structs, will update the one with the greater volume to position (0, 0, 0) and color of "green". If both boxes have equal volume, update the second box. The function should be void.
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