CJCoding With Joseph
15free / daySign inCreate account

Rectangle Area with a Function

Define a struct type named Rectangle with integer fields width and height. Write a function named area that takes a Rectangle (by value) and returns its area (width times height). In main, create a Rectangle with width 6 and height 4, call area, and print the result exactly as: Area: 24 followed by a newline. This combines struct definitions with passing a whole struct into a function.

Expected Output:

Area: 24

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.