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 · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩