#include #include struct position { int x; int y; int z; }; struct box { int itemnum; char color[25]; struct position p; int height; int width; int depth; }; void greater_volume(struct box *, struct box *); int main() { struct box boxes[100]; struct box b1 = {3, "red", {1, 2, 3}, 3, 2, 5}; boxes[0] = b1; boxes[1] = (struct box) {2, "green", {2,3,4}, 3, 4, 5}; for (int i = 0; i < 2; i++) { printf("Item Num: %d\nColor: %s\nPosition: (%d,%d,%d)\nHeight: %d\nWidth: %d\nDepth: %d\n", boxes[i].itemnum, boxes[i].color, boxes[i].p.x, boxes[i].p.y, boxes[i].p.z, boxes[i].height, boxes[i].width, boxes[i].depth); } greater_volume(&boxes[0], &boxes[1]); for (int i = 0; i < 2; i++) { printf("Item Num: %d\nColor: %s\nPosition: (%d,%d,%d)\nHeight: %d\nWidth: %d\nDepth: %d\n", boxes[i].itemnum, boxes[i].color, boxes[i].p.x, boxes[i].p.y, boxes[i].p.z, boxes[i].height, boxes[i].width, boxes[i].depth); } return 0; } void greater_volume(struct box *b1, struct box *b2) { int volume1 = b1->height * b1->width * b1->depth; int volume2 = b2->height * b2->width * b2->depth; if (volume1 > volume2) { b1->p.x = b1->p.y = b1->p.z = 0; strcpy(b1->color, "green"); } else { b2->p.x = b2->p.y = b2->p.z = 0; strcpy(b2->color, "green"); } }