Points with a struct
Points with a struct
A struct groups related values into one type. Here struct Point holds an x and a y. Complete two functions: make_point builds and returns a Point, and move_point shifts an existing one. With a pointer to a struct you reach its fields with ->, so p->x += dx moves it.
Точки со структурой
Структура struct объединяет связанные значения в один тип. Здесь struct Point хранит x и y. Завершите две функции: make_point создаёт и возвращает Point, а move_point сдвигает существующий. Со указателем на структуру можно обращаться к её полям через ->, поэтому p->x += dx перемещает его.
A struct Point with int x, y is given. Complete make_point(int x, int y) to build a Point, and move_point(struct Point *p, int dx, int dy) to shift it by (dx, dy) using ->.
Click Run to see the output here. · Нажмите Запустить, чтобы увидеть результат здесь.