单选题:已知以下程序的输出结果是 (13.000000, 27.000000), 则正确的函数调用语句是:
已知以下程序的输出结果是 (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
#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