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은 기존 Point를 이동시킵니다. 구조체에 대한 포인터를 사용하면 ->으로 필드에 접근하므로, p->x += dx이 이를 이동시킵니다.

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP