Skip to content · ⁨Перейти к содержанию⁩

Points with a struct

English

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 перемещает его.

Log in or create account · ⁨Войти или создать аккаунт⁩

IGCSE, A-Level & AP