We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
struct box
{
/**
* Define three fields of type int: length, width and height
*/
int length;
int width ;
int height;
};
typedef struct box box;
int get_volume(box b) {
/**
* Return the volume of the box
*/
return (b.length * b.width * b.height);
}
int is_lower_than_max_height(box b) {
/**
* Return 1 if the box's height is lower than MAX_HEIGHT and 0 otherwise
*/
return (b.height < MAX_HEIGHT? 1: 0);
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Boxes through a Tunnel
You are viewing a single comment's thread. Return to all comments →
struct box { /** * Define three fields of type int: length, width and height */ int length; int width ; int height; };
typedef struct box box;
int get_volume(box b) { /** * Return the volume of the box */ return (b.length * b.width * b.height); }
int is_lower_than_max_height(box b) { /** * Return 1 if the box's height is lower than MAX_HEIGHT and 0 otherwise */ return (b.height < MAX_HEIGHT? 1: 0); }