格式 struct 名称
struct Rectangle {
int width;
int height;
};
int area(struct Rectangle rectangle);
int area(struct Rectangle rectangle) {
return rectangle.width * rectangle.height;
}
int main(int argc, char *argv[]) {
struct Rectangle rectangle = {
.width = 10,
.height = 20
};
printf("the rectangle area is: %d", area(rectangle));
return 0;
}
标签:struct,area,int,height,rectangle,Rectangle,结构 From: https://www.cnblogs.com/yangchongxing/p/17604725.html