Skip to content · ⁨Passer au contenu⁩

Points with a struct · ⁨Points avec un 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.

Français

Points avec une structure

Un struct regroupe des valeurs liées en un seul type. Ici struct Point contient un x et un y. Complétez deux fonctions : make_point construit et retourne un Point, et move_point déplace un existant. Avec un pointeur vers une structure, vous accédez à ses champs avec ->, donc p->x += dx le déplace.

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP