-->
当前位置:首页 > 题库 > 正文内容

单选题:已知以下程序的输出结果是 (13.000000, 27.000000), 则正确的函数调用语句是:

Luz4年前 (2021-12-28)题库949
已知以下程序的输出结果是 (13.000000, 27.000000), 则正确的函数调用语句是:

#include <stdio.h>

typedef struct _point
{
float x;
float y;
}point;

point add(const point *p, const point *q);

int main(void)
{
point pt1 = {10, 20}, pt2 = {3, 7};
point pt = 在此处调用add函数;
printf("(%f, %f)", pt.x, pt.y);
return 0;
}

point add(const point *p, const point *q)
{
point pt;
pt.x = p->x + q->x;
pt.y = p->y + q->y;
return pt;
}




A.add(pt1, pt2)
B.add(&pt1, &pt2)
C.add(*pt1, *pt2)
D.add(pt.x, pt.y)


答案:B

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。