return c;
}
(d)
Complex add_complex(Complex c1, Complex c2)
{
Complex c3;
c3.real = c1.real + c2.real;
c3.imaginary = c1.imaginary + c2.imaginary;
return c3;
}
11. [was #10; modified] The a member will occupy 8 bytes, the union e will take 8 bytes (the largest member, c, is 8 bytes long), and the array f will require 4 bytes, so the total space allocated for s will be 20 bytes.
14. [was #12; modified]
(a)
double area(struct shape s)
{
if (s.shape_kind == RECTANGLE)
return s.u.rectangle.height * s.u.rectangle.width;
else
return 3.14159 * s.u.circle.radius * s.u.circle.radius; }
(b)
struct shape move(struct shape s, int x, int y)
{
struct shape new_shape = s;
new_shape.center.x += x;
new_shape.center.y += y;
return new_shape;
}
(c)
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库C语言程序设计现代方法第16章答案(2)在线全文阅读。
相关推荐: